Is Monitor class in C# blocks by spinning (user-mode) or by stopping a thread (kernel-mode)?
I was not able to find an answer to this question in the documentation.
I clearly understand how the Monitor interacts with objects. It uses the sync blocks array created by CLR and just manipulates the sync block field of an object to point to a specific sync block. Then the sync block will contain an id of a thread which took the lock, the recursion count (number of times the thread took the look). And the Monitor.Enter
will block other threads until the recursion count is 0.
But I do not understand how the blocking will happen. Will the blocked (waiting) threads transition to kernel mode and stop there or will they just spin around wasting CPU?