I have two questions regarding the state of a thread created in managed code by the CLR.
There appears to be no thread state to represent a thread waiting on a blocked I/O operation.
For e.g. waiting on a disk driver to respond with a stream of bytes read from the disk, or waiting on a network port for a stream of bytes to arrive from another process or computer.
Why is that? Or if that isn't the case, could you please tell me which member of the
ThreadState
enumeration represents this state?The closest I came to find was the
WaitSleepJoin
state, but its documentation reads as follows:WaitSleepJoin
The thread is blocked. This could be the result of calling Thread.Sleep or Thread.Join, of requesting a lock — for example, by calling Monitor.Enter or Monitor.Wait — or of waiting on a thread synchronization object such as ManualResetEvent.
From the excerpt of the documentation reproduced above, please consider this phrase:
...of requesting a lock — for example, by calling Monitor.Enter or Monitor.Wait
Why would a thread block if it simply requested for a lock? Does that documentation actually imply, "While waiting for a lock, presently held by another thread, on a resource to be released. In other words, during a
SpinWait
? In other words, while waiting to be pulsed by the present owner of the lock?"