Subj : Re: Improving read-write lock To : comp.programming.threads From : Joe Seigh Date : Thu Feb 24 2005 02:19 pm On Thu, 24 Feb 2005 18:30:16 GMT, Howard Hinnant wrote: > In article , > "Joe Seigh" wrote: > >> > Why do you think leaving the lock locked would be a better default? >> > >> You need to explicitly ensure the shared data is in a valid state. If >> so than you can manually reset the lock. Otherwise it's better to leave >> the lock locked and let everything hang. > > Code that leaves data in an invalid state when an exception propagates > out is broken anyway. It won't matter whether you unlock the mutex or > not. It obvious when a program hangs when an lock is not unlocked. It not always so obvious when a program has incorrect results because data is corrupted. > > Writing in C++ means writing code that satisfies at least the basic > exception guarantee, (whether or not multi-threading is involved). > "means"? Apparently very few people write in C++ then, but in something that looks misleadingly similar. :) -- Joe Seigh .