
"vicente.botet" <vicente.botet@wanadoo.fr> writes:
In the Join library I have see the following idiom
mutex mtx; condition_variable cond; unsigned num_blocked;
void foo() { unique_lock l(mtx); ++num_blocked; cond.wait(lock); --num_blocked;
// ... }
void foo() { unique_lock l(mtx); // ... if (num_blocked > 0) cond.notify_one(); // ... }
Does this perform better in some contexts? if yes in which ones?
It really shouldn't do. The check is part of the notify. Anthony -- Anthony Williams | Just Software Solutions Ltd Custom Software Development | http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL