You might notice that you have to pass a mutex to pthread_cond_wait, when you are thinking to yourself “Why do I need a mutex when all I want to do is signal a waiting thread?”
This is one of those questions that doesn’t have an immediately obvious answer. Well, you are right that you can just use a dummy mutex and your thread will properly wake up, but if you actually want to signal the thread based on a *boolean condition* (as determined by real C executing code) then you need to pass a meaningful mutex.
Here is a really good explanation of when you would want to do that:
http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
Happy reading.
Mate.. you can’t make a blogpost with a title like that and then refer us to some big ass page with the answer in there some there..
It wasn’t to ask, but to tell. I’m glad you found it helpful.
Thanks man!
worst blog ever