
22 Aug
2007
22 Aug
'07
12:05 p.m.
Yuval Ronen wrote:
Howard Hinnant wrote:
Because of this, it is not possible (in the above use case) for there to be a set_mutex on the condition to change the facade, since both facades are simultaneously in use.
Yes, I've realized that too late. My set_mutex() function is useless because it has to be atomic with the wait().
I've just thought that it might be not so useless after all. 'set_mutex' is supposed to be called after the mutex was locked, and before calling condition::wait. Because the mutex is locked, we are protected against simultaneous use. There can be a problem when multiple readers lock for read, and simultaneously call set_mutex, but if we assume they all set the same mutex it shouldn't be a problem.