Proper Approach for Temporarily Suspending a Worker Thread
问题 I have a worker thread that may be active for short bursts of time and idle for rest of the time. I'm thinking to put the thread to sleep and then awake it when needed. Any additional recommendations for this I should be aware of? Thanks! this is in C#/.NET4 回答1: Just use an event to pause the worker thread: reset - paused, set - unpaused (working) state. Here is the draft version of code that demonstrates the approach. class Worker { private Thread _thread; // Un-paused by default. private