views:

29

answers:

2

Hi all. Just getting started with pthreads & condition variables. I have an object that has a couple of mutexes and a condition variable as members.

I initialize them all in the constructor. After using the condition variable to signal waiting threads, do I need to reset it somehow if the object's state changes and the condition is no longer true? Or is this done automatically after the condition variable is toggled and all waiting threads are notified?

Thanks!

A: 

No, you don't have to reset anything. Just be sure to use the mutexes correctly. See this tutorial if you haven't already.

Matthew Flaschen
Thanks. They're working nicely for me.
A: 

Yep, that's the go-to tutorial for everyone it seems. Thanks for your answer.