From Here...
The best book by far on threading is Jeffrey Richter's Advanced Windows (Microsoft Press). I have all the editions in my library, and it's great reading!
Some of the tools I've used to help with deadlocks and race conditions are Intel's VTune, the Intel Thread Checker for Windows, and their Thread Profiler. These tools are the best to come along in years for programmers; you can download a 30-day fully functioning demo to see how it works for you. Once I installed the tools, I found my race condition in about an hour, and most of that time was learning how to use the tools.
Microsoft's WinDbg debugger is also free to download and use. The MSDN web site includes streaming videos of how to debug threads by using this tool.
Threads can be your best friend if used correctly, or your worst enemy if implemented incorrectly.