I have an auto-reset event object, and there is one thread waiting on it. If now I call SetEvent, can it be guaranteed that the event object is nonsignaled when SetEvent has returned?
I have two threads that run in a A-B-A-B-… way. As soon as A wakes up B, A will start waiting for B. If I can wait on the same event object right after signaled it, well… I can save one event object.
If you ask why I don’t just use one single thread, they are in different processes.
The event becomes unsignaled when the waiter is released. There is no guarantee that the waiter will be released before the call to
SetEventreturns.