More About a Thread’s Life Cycle
So far, we’ve seen three states a thread can be in. You should be able to recite at least two of them. First of all, each new Thread
instance represents a thread in a state where it hasn’t been started yet. Upon calling the Start
method, the thread can enter the running state, where it’s executing code. A third state might not be immediately obvious because we haven’t talked about it much: A thread can be waiting for some operation to be completed, which is often referred to as being blocked.
Blocking is Hard
True blocking of threads is quite uncommon in the world of managed code. Because of the deep support for COM interoperability, the managed runtime has to make sure that threads can continue to dispatch ...
Get C# 4.0 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.