Subj : Re: Avoiding synchronization (pthreads) To : comp.programming.threads From : Ian Pilcher Date : Wed Mar 02 2005 10:33 pm David Schwartz wrote: > Oh for the love of god, just lock it properly. Come back when you have > performance data to demonstrate that this is an issue. If half as much > effort as is put into avoiding locks were put into using them properly, the > average quality of multi-threaded code would go *way* up. You're right, of course. Like the OP, however, I would like to avoid excessive calls to the pthread APIs. In my case, the reason is error handling rather than performance. Call me overly pedantic, but I believe that a well written program should test the return value of every function call that can fail and handle failures appropriately. 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). It effectively makes it impossible to write error handling code that doesn't require it's own error handling logic, ad infinitum. I'm interested in hearing how people handle this situation in a professional environment, where the code has to get out the door -- ignore the possibility that the call may fail, fill the code with aborts (or something equally drastic), or something incredibly clever that I haven't thought of. -- ======================================================================== Ian Pilcher i.pilcher@comcast.net ======================================================================== .