Is there any particular context where ManualResetEvent is more suitable than a while loop?
Absolutely. There are two primary reasons: latency and efficiency.
Context-switching the thread to start it running again is relatively expensive, when it's just going to go back to sleep, and the approach you've given will take an average of 50ms to respond to the hasInitialized
variable being set - assuming it responds at all. (You don't have any explicit memory barriers, so it's possible that the thread won't actually see a change to the variable at all. I suspect that calling Thread.Sleep
effectively adds a memory barrier, but it's not guaranteed.) With OS/CLR-level synchronization primitives, a thread can respond much faster.