forked from boostorg/beast
Add initiallySignaled parameter to WaitableEvent
This commit is contained in:
1 parent
47456a1723
commit
7008db7dda
3 files changed
+11
-3
No files matched your search
@@ -54,7 +54,7 @@ void CriticalSection::exit() const noexcept
|
||||
|
||||
|
||||
//==============================================================================
|
||||
WaitableEvent::WaitableEvent (const bool useManualReset) noexcept
|
||||
WaitableEvent::WaitableEvent (const bool useManualReset, bool initiallySignaled) noexcept
|
||||
: triggered (false), manualReset (useManualReset)
|
||||
{
|
||||
pthread_cond_init (&condition, 0);
|
||||
@@ -65,6 +65,9 @@ WaitableEvent::WaitableEvent (const bool useManualReset) noexcept
|
||||
pthread_mutexattr_setprotocol (&atts, PTHREAD_PRIO_INHERIT);
|
||||
#endif
|
||||
pthread_mutex_init (&mutex, &atts);
|
||||
|
||||
if (initiallySignaled)
|
||||
signal ();
|
||||
}
|
||||
|
||||
WaitableEvent::~WaitableEvent() noexcept
|
||||
|
||||
@@ -80,9 +80,11 @@ void CriticalSection::exit() const noexcept
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
WaitableEvent::WaitableEvent (const bool manualReset) noexcept
|
||||
WaitableEvent::WaitableEvent (const bool manualReset, bool initiallySignaled) noexcept
|
||||
: internal (CreateEvent (0, manualReset ? TRUE : FALSE, FALSE, 0))
|
||||
{
|
||||
if (initiallySignaled)
|
||||
signal ();
|
||||
}
|
||||
|
||||
WaitableEvent::~WaitableEvent() noexcept
|
||||
|
||||
Reference in new issue
Block a user