Something unclear to me about threads...
-
Quoting from MSDN: Don't control the execution of worker threads from your main program (using events, for example). Instead, design your program so that worker threads are responsible for waiting until work is available, executing it, and notifying other parts of your program when finished. If your worker threads do not block, consider using thread pool threads.
Monitor.PulseAll
is useful in situations where worker threads block. What does that mean? Specifically, what does it mean to say that a thread blocks or does not block? Thank you. Sammy "A good friend, is like a good book: the inside is better than the cover..." -
Quoting from MSDN: Don't control the execution of worker threads from your main program (using events, for example). Instead, design your program so that worker threads are responsible for waiting until work is available, executing it, and notifying other parts of your program when finished. If your worker threads do not block, consider using thread pool threads.
Monitor.PulseAll
is useful in situations where worker threads block. What does that mean? Specifically, what does it mean to say that a thread blocks or does not block? Thank you. Sammy "A good friend, is like a good book: the inside is better than the cover..."It means that you have the worker threads query for information, or jobs to complete. They wait (block) on a wait handle that is signaled when work is available. They get the work, perform their operations, then block again waiting for the wait handle to be signaled.
Microsoft MVP, Visual C# My Articles