diff options
| author | Robin Kertels <robin.kertels@gmail.com> | 2023-01-29 16:16:29 +0100 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2023-02-04 14:31:16 +1300 |
| commit | 9affbfe683ac568d89a00bf6eb20af588ccd1b03 (patch) | |
| tree | adea1191fec349cae0de224d6c35228b35771bbc /Source/Core/Common/WorkQueueThread.h | |
| parent | 9badcc6eb8b95252bac91305b06e1c0ebaea329a (diff) | |
WorkQueueThread: Implement proper Flush
and rename the existing Flush to FlushOne.
Diffstat (limited to 'Source/Core/Common/WorkQueueThread.h')
| -rw-r--r-- | Source/Core/Common/WorkQueueThread.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/Core/Common/WorkQueueThread.h b/Source/Core/Common/WorkQueueThread.h index 7d3d9395fb..2a756f3d7e 100644 --- a/Source/Core/Common/WorkQueueThread.h +++ b/Source/Core/Common/WorkQueueThread.h @@ -91,7 +91,7 @@ public: } // Doesn't return until the most recent function invocation has finished. - void Flush() + void FlushOne() { if (m_thread.joinable()) { @@ -101,6 +101,17 @@ public: } } + // Doesn't return until the queue is empty. + void Flush() + { + if (m_thread.joinable()) + { + m_flush.Set(); + m_wakeup.Set(); + m_flushed.Wait(); + } + } + bool IsFlushing() const { return m_flush.IsSet() || m_shutdown.IsSet(); } private: |
