Under Windows, signal () will only release one thread if the event was created as automatic-reset:
CreateEvent()
[quote]BOOL bManualReset
If this parameter is TRUE, the function creates a manual-reset event object, which requires the use of the ResetEvent function to set the event state to nonsignaled. If this parameter is FALSE, the function creates an auto-reset event object, and system automatically resets the event state to nonsignaled after a single waiting thread has been released. [/quote]
I don’t understand the issue.
“any threads” doesn’t mean all threads. any:
one, a, an, or some; one or more without specification or identification: If you have any witnesses, produce them. Pick out any six you like.
(And the same behaviour applies on Linux)
[quote=“TheVinn”]
When the WaitableEvent is signaled:
If the WaitableEvent is manual reset, wakes up all threads that are currently waiting or will wait on this object, until it’s reset.
If the WaitableEvent is automatic reset, wakes up a single thread if there are one or more threads waiting on the object, else wakes up the next thread that calls wait().[/quote]