Does SetEvent unlock one or all pending threads?

If an event expects 2 or more threads, does SetEvent unlock one or all of them (or some of them)?

+4
source share
2 answers

It depends on whether it is an event manually or automatically reset. If this guide is reset, then multiple threads can be released until reset. If it is auto-reset, then only one will be signaled.

+4
source

The auto-reset event will reset after a single thread wakes up. Manual reset will even be set until reset so that it can wake up an arbitrary number of threads. It's a little difficult to find out when you need to reset, if you want all the threads waiting for it to wake up exactly once (but again, if you're interested, this indicates a probable design problem).

+2
source

Source: https://habr.com/ru/post/1303482/