If so, that would imply that the blocked thread can enter when another thread calls Monitor.Wait(obj). This seems a little odd to me in that it must contend with other threads in the ready queue.
If not, can it only un-block when Monitor.Exit(obj) is called? Or is it in obj’s waiting queue?
This isn’t clearly documented in the MSDN Library class documentation.
Yes, the blocked thread can enter when another thread calls
Monitor.Wait. Why would it not be able to?In particular, it has to be able to – as the thread which is currently blocking may be the one which is going to call
Pulse.Consider a producer/consumer queue:
This scenario wouldn’t work if the producer thread were still waiting for an Exit call.