Subj : Re: Avoiding synchronization (pthreads) To : comp.programming.threads From : ptjm Date : Fri Mar 04 2005 04:19 am In article <_7OdnQu-xMkKDrvfRVn-ug@comcast.com>, Ian Pilcher wrote: % [...] % This sounds good until you try to figure out how to "appropriately" % handle the fact that pthread_mutex_unlock can fail on alternate Tuesdays % (my interpretation of XSH 2.3). If this has got you ranting, you need to learn to relax. There are only two ways pthread_mutex_unlock() can fail -- either the mutex isn't a mutex, or the mutex isn't locked by the calling thread. Perhaps you're ranting about the fact that it's not guaranteed to fail in either of those cases, but I don't think the use of the word may instead of shall makes it any more difficult to handle the failure. % I'm interested in hearing how people handle this situation in a % professional environment, where the code has to get out the door -- It seems to me that people do their best to avoid using mutexes when they ought to, for all sorts of stupid reasons. Unless you're using recursive mutexes, I don't think there's any way for mutex lock or mutex unlock to fail unless you have a serious programming error or a castrophic bug. I think it's reasonable to ignore the return code, but how can you handle a failure other than by bailing out? -- Patrick TJ McPhee North York Canada ptjm@interlog.com .