We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 604b1f7 commit f1ae635Copy full SHA for f1ae635
src/lib/ManualResetEvent.cpp
@@ -58,16 +58,12 @@ bool ManualResetEvent::Wait(const int32_t timeout)
58
{
59
UniqueLock lock(m_mutex);
60
61
+ auto isSignaled = [this] { return m_signaled.load(); };
62
+
63
if (timeout > -1)
- {
- if (!m_signaled)
64
- m_handle.wait_for(lock, milliseconds(timeout));
65
- }
+ m_handle.wait_until(lock, steady_clock::now() + milliseconds(timeout), isSignaled);
66
else
67
68
- while (!m_signaled)
69
- m_handle.wait(lock);
70
+ m_handle.wait(lock, isSignaled);
71
72
return m_signaled;
73
}
0 commit comments