[cap-talk] small notes re: waterken

James A. Donald jamesd at echeque.com
Sat Mar 5 20:14:42 PST 2011


On 2011-03-06 12:49 PM, David-Sarah Hopwood wrote:
> On 2011-03-06 01:09, James A. Donald wrote:
>> Suppose your code, your little procedure that runs for a few
>> milliseconds in a gigantic program written by hundreds of
>> people that runs for weeks at a time, grabs a mutex.  Then
>> something unexpected and bad happens, possibly in a routine
>> written by someone else years ago, which routine does all
>> sorts of strange stuff unknown to you.  Whatever your code
>> was doing is now aborted, so obviously the mutex has to be
>> released.

> Not releasing the mutex will cause a deadlock if any other code
> tries to acquire that resource, which is a better failure mode
> than releasing the mutex for a resource that is in an inconsistent
> state. The mutex was there for a reason; attempting to use the
> object after the failure may cause a much worse failure.

Typical case:  create an item and add it to the linked list.  Creating 
the item may fail.  linking it in will not.



More information about the cap-talk mailing list