My latest Windows with C++ column, Thread Pool Synchronization, is now available in the November 2011 issue of MSDN Magazine. From the article:
I’ve said it before: Blocking operations are bad news for concurrency. Often, however, you need to wait for some resource to become available, or perhaps you’re implementing a protocol that stipulates some amount of time needs to elapse before resending a network packet. What do you do then? You could use a critical section, call functions like Sleep and WaitForSingleObject and so on. Of course, that means you’ll have threads just sitting around blocking again. What you need is a way for the thread pool to wait on your behalf without affecting its concurrency limits. The thread pool can then queue a callback once the resource is available or the time has elapsed.
I hope you enjoy it. Next month I wrap up the series on the thread pool by exploring thread pool timers and I/O.
You can find links to more of my articles here.