Subj : Re: Improving read-write lock To : comp.programming.threads From : Joe Seigh Date : Fri Feb 25 2005 07:22 am On Fri, 25 Feb 2005 17:47:12 +1000, David Holmes wrote: > But it is not a simple story. Once things are broken the response to be > being broken depends very much on the severity of the problem brokenness > might cause. If the exception propogates and locks are not released then > recovery may be impossible without locks that support ownership-stealing. I > like to think that releasing the lock at least allows for the possibility of > recovery - but really how do you recover from an unexpected exception. In > most cases, most programs just give up and die, or give up and hang. > You can add a new state to the lock to indicate "damage". You could add a return code or a new exception to indicate such. That might make pthread cancelation and cleanup a bit interesting if damaged mutexes were used. Alternatively, you could have a cleanup thread waiting to do the cleanup. I see no reason another thread can't do cleanup on data that's shared in the first place. Assuming cleanup is possible. -- Joe Seigh .