In http://reviews.llvm.org/D8796#151237, @EricWF wrote:

> > The fix itself looks correct to me.
>
>
> Good! The fix I had before released the mutex before calling notify_all(). I 
> was hoping to do that as an optimization but I don't think it is possible. 
> Should I be at all concerned about notifying other threads while holding the 
> lock?


There's no requirement that the mutex be either locked or unlocked when you 
call notify_*(). One choice might be faster than the other, but it depends on 
the mutex+condvar implementation. (A smart mutex+condvar can ensure that no 
thread is unblocked before the mutex is unlocked.) If you're tempted to 
optimize this, consider optimizing the fact that std::mutex uses pthread_mutex, 
which is big and slow, first.


http://reviews.llvm.org/D8796

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to