I’m probably missing something obvious, but I can’t see any difference between std::condition_variable and std::condition_variable_any. Why do we need both?
I’m probably missing something obvious, but I can’t see any difference between std::condition_variable and
Share
std::condition_variableis more specialized, and therefore can be more efficient when you don’t need the flexibility ofstd::condition_variable_any.From N3290 §30.5[thread.condition]/1
Actually, in LLVM’s libc++,
condition_variable_anyis implemented using the more specializedcondition_variable(which uses pthread_cond_t) on a shared_mutex.