summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/osdsync.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/osdsync.h')
-rw-r--r--src/osd/osdsync.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/osd/osdsync.h b/src/osd/osdsync.h
index 3a286b60afa..21cb0aca34c 100644
--- a/src/osd/osdsync.h
+++ b/src/osd/osdsync.h
@@ -15,7 +15,7 @@
#include <atomic>
#include <condition_variable>
-#include "osdcomm.h"
+#include "osdcore.h"
/***************************************************************************
SYNCHRONIZATION INTERFACES - Events
@@ -136,16 +136,17 @@ public:
Return value:
- None
+ Whether or not the event was actually signalled (false if the event had already been signalled)
Notes:
All threads waiting for the event will be signalled.
-----------------------------------------------------------------------------*/
- void set()
+ bool set()
{
m_mutex.lock();
- if (m_signalled == false)
+ bool needs_signal = !m_signalled;
+ if (needs_signal)
{
m_signalled = true;
if (m_autoreset)
@@ -154,13 +155,14 @@ public:
m_cond.notify_all();
}
m_mutex.unlock();
+ return needs_signal;
}
private:
std::mutex m_mutex;
std::condition_variable m_cond;
- std::atomic<int32_t> m_autoreset;
- std::atomic<int32_t> m_signalled;
+ int32_t m_autoreset;
+ int32_t m_signalled;
};