http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50862
--- Comment #9 from bartek 'basz' szurgot <bartosz.szurgot at pwr dot wroc.pl> 2011-10-26 06:39:15 UTC --- implementation is nice. i think there is still one more problem to be fixed, though. namely the line: ~_Unlock() { _M_lock.lock(); } since lock() may throw an exception, which should never take place in d-tor. more over, ~_Unlock() can happen to be called because of an exception thrown from: _M_cond.wait(__my_lock2); which means terminate().