The call to
always block the calling thread if at least one the the event wait handles is in non-signaled state.
You simply don't notice it or never reach blocking state because all threads complete very quickly. You never know which thread reach certain point of execution first, and an attempt to rely on the order of execution is called race condition
To check this up, add a call to
before the line "
;" — you will observe the blocking is sleep time is long enough.
I don't say
such call to
should be use in real-life programming. Just the opposite: trying to resolve any logical problem with delay would be absolutely incorrect. You can do it just for experimental purpose.
As all you code does not seem to have any practical sense, I assume you do it all for experimental purposes yourself. Well, it's good to practice things; good luck.