On Thursday, September 11, 2003, at 10:02 PM, Greg Stein wrote:
I've written applications like this. One thread will create a mutex, stash
that away in a global, or somesuch, and then lock the thing *twice*. When
another thread wants the first one to resume, it unlocks the mutex.
Eeww, that's not what mutexes were designed to do, and there are cases where that will fail (specifically, if you try to do that with multiple threads, you don't at all get fair scheduling for the threads blocking behind that mutex.)
If we have another way for a thread to block, then have another thread say
"okay. go ahead and proceed", then I'm all for removing nested mutexes.
Yeah, that's totally what condition variables are for, and IIRC we have those implemented across all APR-supported platforms.
-aaron
