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;
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;
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());
}
std::lock_guard locker{m_lock};
m_stopping = true;
- m_cond.Signal();
+ m_cond.notify_all();
return;
}
c->release();
std::lock_guard locker{m_lock};
m_stopping = true;
- m_cond.Signal();
+ m_cond.notify_all();
return;
}
}
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;