Juce::WaitableEvent::signal() behaves different from docs


#1

juce::WaitableEvent::signal()

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]


#2

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)


#3

[quote=“X-Ryl669”]any:
one, a, an, or some; one or more without specification or identification[/quote]

Except that in this context, another definition of ‘any’ is more suited:

So yeah in this case ‘any’ means ‘all.’

Let’s make it easy. This is how the docs for signal() should read:


#4

Better, if you really need to be pedantic.

[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]