How does waiting on a locked object by a managed thread work exactly in .NET (Windows)
If we have a thread that is waiting to acquire a lock for a while and the thin lock of the locked object is promoted to a fat lock and a kernel object is created (sync block table etc) - what mechanism is used to wake up the waiting thread exactly?
3 Replies
That's really an operating system question.
I believe on Windows it uses a reset event
okay, so the CLR communicates with the OS to create this kernel event by subscribing the waiting thread to it and the OS wakes up the waiting native thread that underlies the managed thread when the lock is freed?
Basically yes.