Lock free condition_variable or using shared_lock
I'm not too familiar with the mechanisms which underlie mutexs and conditionals, which is why I'm asking this question. Is it possible to modify condition_variable so that wait() can be called on shared_lock? The use case would be it is acceptable to release all threads waiting on a condition_variable when notify_all() is called. Using a unique_lock, every thread who wakes up will then have to obtain the lock before proceeding; this being a potential bottleneck. An even more performant alternative to using shared_lock would be with a dummy lock never blocks when dummy_lock.lock() is called. These are things I would like to contribute, but I need would need some guidance and a review of feasibility. Thanks for the help, Kirk
On 29 Jul 2014 at 22:57, Kirk Liberty wrote:
I'm not too familiar with the mechanisms which underlie mutexs and conditionals, which is why I'm asking this question.
Is it possible to modify condition_variable so that wait() can be called on shared_lock? The use case would be it is acceptable to release all threads waiting on a condition_variable when notify_all() is called. Using a unique_lock, every thread who wakes up will then have to obtain the lock before proceeding; this being a potential bottleneck.
Doesn't condition_variable_any already do this? Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
On 07/30/2014 04:57 AM, Kirk Liberty wrote:
Is it possible to modify condition_variable so that wait() can be called on shared_lock? The use case would be it is acceptable to release all threads
Use condition_variable_any.
waiting on a condition_variable when notify_all() is called. Using a unique_lock, every thread who wakes up will then have to obtain the lock before proceeding; this being a potential bottleneck.
This is also the case for shared_lock.
participants (3)
-
Bjorn Reese
-
Kirk Liberty
-
Niall Douglas