Why you should never suspend a thread
Posted: Wed Nov 12, 2008 5:30 am
I thought it was a good read. I hadn't considered that a thread might get paused before releasing a mutex lock.
For example, even if your thread has no mutex locks a function you're calling may. LoadLibrary/OpenLibrary for example will deadlock if it doesn't return and you try to open another library in a different thread.
It's best to signal your thread to suspend from the inside and resume from outside.
http://blogs.msdn.com/oldnewthing/archi ... 55988.aspx
For example, even if your thread has no mutex locks a function you're calling may. LoadLibrary/OpenLibrary for example will deadlock if it doesn't return and you try to open another library in a different thread.
It's best to signal your thread to suspend from the inside and resume from outside.
http://blogs.msdn.com/oldnewthing/archi ... 55988.aspx