From 84e9f3f190d328bab3f1b85fb9883935fa7e8953 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 15 Feb 2016 12:30:41 -0500 Subject: [PATCH] librados_test_stub: watch_flush should block until notifies complete It shouldn't block until all the acks are received as that is not how librados handles the method. Signed-off-by: Jason Dillaman --- src/test/librados_test_stub/TestWatchNotify.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/librados_test_stub/TestWatchNotify.cc b/src/test/librados_test_stub/TestWatchNotify.cc index 7bd2ef722bbd..a35d081ce271 100644 --- a/src/test/librados_test_stub/TestWatchNotify.cc +++ b/src/test/librados_test_stub/TestWatchNotify.cc @@ -21,6 +21,7 @@ TestWatchNotify::~TestWatchNotify() { } void TestWatchNotify::flush() { + // block until we know no additional async notify callbacks will occur Mutex::Locker locker(m_lock); while (m_pending_notifies > 0) { m_file_watcher_cond.Wait(m_lock); @@ -176,6 +177,10 @@ void TestWatchNotify::execute_notify(const std::string &oid, } finish_notify(oid, notify_id); + + if (--m_pending_notifies == 0) { + m_file_watcher_cond.Signal(); + } } void TestWatchNotify::ack_notify(const std::string &oid, @@ -226,10 +231,6 @@ void TestWatchNotify::finish_notify(const std::string &oid, if (watcher->watch_handles.empty() && watcher->notify_handles.empty()) { m_file_watchers.erase(oid); } - - if (--m_pending_notifies == 0) { - m_file_watcher_cond.Signal(); - } } } // namespace librados -- 2.47.3