Subj : Re: How to return a value before leaving critical section? To : comp.programming.threads From : David Schwartz Date : Tue Jul 19 2005 08:00 pm "MC" wrote in message news:gn7rd1hl3keogo473ml8onbvehujro4smk@4ax.com... > 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 .