
25 Aug
2007
25 Aug
'07
12:59 a.m.
Peter Dimov wrote:
Howard Hinnant wrote:
Or should condition::wait() not take any parameters, or take only mutexes, making the issue moot?
I think that we ought to keep the lock argument, even if we end up not using it for anything except debug checks. It helps people avoid accidental calls to 'wait' without locking the mutex first.
If, by "It helps people avoid accidental...", you mean "at compile time", then it's not always detected in compile time, because the existence of a lock doesn't mean a mutex is locked (e.g. unique_lock). If you mean "at run time", then it can be checked without the lock being passed as a parameter to wait(). Either way, I see no need for passing it.