Merge pull request #29474 from wjwithagen/wjw-fix-rbd_ggate_Server.cc

rbd-ggate: fix compile errors from ceph::mutex update

Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-08-04 22:42:19 +08:00 committed by GitHub
commit 6415160dbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<IOContext> 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;