...
In this example, each thread has its own predicate because each requires current_step
to have a different value before proceeding. Upon the signal operation (pthread_cond_signal()
), any of the waiting threads can wake up. If, by chance, it is not the thread with the next step value, that thread will wait again (pthread_cond_wait()
), resulting in a deadlock situation because no more signal operations will occur.
...