diff options
Diffstat (limited to 'src/OSSupport/Event.h')
-rw-r--r-- | src/OSSupport/Event.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/OSSupport/Event.h b/src/OSSupport/Event.h index 572388a3f..2c58ba485 100644 --- a/src/OSSupport/Event.h +++ b/src/OSSupport/Event.h @@ -12,6 +12,7 @@ #include <mutex> #include <condition_variable> +#include <atomic> @@ -28,7 +29,11 @@ public: /** Sets the event - releases one thread that has been waiting in Wait(). If there was no thread waiting, the next call to Wait() will not block. */ - void Set (void); + void Set(void); + + /** Sets the event - releases all threads that have been waiting in Wait(). + If there was no thread waiting, the next call to Wait() will not block. */ + void SetAll(void); /** Waits for the event until either it is signalled, or the (relative) timeout is passed. Returns true if the event was signalled, false if the timeout was hit or there was an error. */ @@ -37,9 +42,9 @@ public: private: /** Used for checking for spurious wakeups. */ - bool m_ShouldWait; + std::atomic<bool> m_ShouldContinue; - /** Mutex protecting m_ShouldWait from multithreaded access. */ + /** Mutex protecting m_ShouldContinue from multithreaded access. */ std::mutex m_Mutex; /** The condition variable used as the Event. */ |