Subj : Re: How to return a value before leaving critical section? To : comp.programming.threads From : MC Date : Wed Jul 20 2005 06:46 pm >> How do you see this code making use of a 'lock holder' class? What >> would the calling code look like? > > For this, I wouldn't bother. I'd just do either this: > >lock(); >if(timeout()) { unlock(); return; } >unlock(); > > Or: > >lock(); >BOOL ret=get_value(); >unlock(); >return ret; > > Depending on what you like. You can also do this: > >BOOL Timeou(void) >{ // call without a lock > lock(); > BOOL ret=timeout_variable; > unlock(); > return ret; >} > > And then do "if (!success||Timeout())" > > DS > Makes sense. Thanks! .