Is it possible to “wait” on a boost::condition_variable without having to acquire a mutex lock first? Failing that, can this be done using the pthread lib directly somehow?
For simplicity I’d like to avoid going directly to the OS layer (such as futex on linux). But I also don’t want the overhead of the mutex call.
I’m quite aware of the race conditions doing this under normal circumstances. I have that covered in another fashion.
The mutex must be acquired first in both case.
From boost.threads documentation :
From pthread_cond_wait man page :
I’m not aware of any alternative.