From: Willem Jan Withagen Date: Sat, 3 Aug 2019 20:48:03 +0000 (+0200) Subject: rbd-ggate: fix compile errors from ceph::mutex update X-Git-Tag: v15.1.0~1968^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29474%2Fhead;p=ceph.git rbd-ggate: fix compile errors from ceph::mutex update Signed-off-by: Willem Jan Withagen --- diff --git a/src/tools/rbd_ggate/Server.cc b/src/tools/rbd_ggate/Server.cc index 4a38a53fe773..2565ba10fa6f 100644 --- a/src/tools/rbd_ggate/Server.cc +++ b/src/tools/rbd_ggate/Server.cc @@ -31,10 +31,8 @@ void Server::run() { dout(20) << "entering run loop" << dendl; { - std::lock_guard locker{m_lock}; - while (!m_stopping) { - m_cond.WaitInterval(m_lock, utime_t(1, 0)); - } + std::unique_lock locker{m_lock}; + m_cond.wait(locker, [this] { return m_stopping;}); } dout(20) << "exiting run loop" << dendl; @@ -79,14 +77,14 @@ void Server::io_finish(IOContext *ctx) { ctx->item.remove_myself(); m_io_finished.push_back(&ctx->item); - m_cond.Signal(); + m_cond.notify_all(); } Server::IOContext *Server::wait_io_finish() { dout(20) << dendl; std::unique_lock locker{m_lock}; - m_cond.wait(locker, [this] { return !m_io_finished.empty() || m_stopping}); + m_cond.wait(locker, [this] { return !m_io_finished.empty() || m_stopping;}); if (m_io_finished.empty()) { return nullptr; @@ -103,11 +101,8 @@ void Server::wait_clean() { ceph_assert(!m_reader_thread.is_started()); - std::lock_guard locker{m_lock}; - - while (!m_io_pending.empty()) { - m_cond.Wait(m_lock); - } + std::unique_lock locker{m_lock}; + m_cond.wait(locker, [this] { return m_io_pending.empty();}); while (!m_io_finished.empty()) { std::unique_ptr free_ctx(m_io_finished.front()); @@ -166,7 +161,7 @@ void Server::reader_entry() { } std::lock_guard locker{m_lock}; m_stopping = true; - m_cond.Signal(); + m_cond.notify_all(); return; } @@ -199,7 +194,7 @@ void Server::reader_entry() { c->release(); std::lock_guard locker{m_lock}; m_stopping = true; - m_cond.Signal(); + m_cond.notify_all(); return; } } @@ -225,7 +220,7 @@ void Server::writer_entry() { derr << ctx.get() << ": send: " << cpp_strerror(r) << dendl; std::lock_guard locker{m_lock}; m_stopping = true; - m_cond.Signal(); + m_cond.notify_all(); return; } dout(20) << ctx.get() << " finish" << dendl;