Using recursive mutexes and condition variables?
I have a question regarding recursive mutexes and condition variables. Given a mutex created with one of the following attributes: DCE threads pthread_mutexattr_setkind_np( &attr, MUTEX_RECURSIVE_NP ); X/Open XSH5 (UNIX98) pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); What exactly is the behavior of a pthread_cond_wait() and what effect do “nested” locks have on this behavior? Do mixing recursive locks and condition variables make any sense? This is largely achademic. However, I (like everyone else in known space/time) maintain an OO abstraction of a portable subset of Pthreads and would like to know the appropriate semantics. Since the advent of the framework (about 3 years ago) I have managed to avoid using recursive mutexes. Unfortunately, my back may be against the wall on a few new projects and I may be forced to use them. They seem to be a real pain. And yes I promise this concludes my postings on cvs for the forseen future.