< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [sipX-dev] Critical sections


On Thu, 2009-07-02 at 10:42 -0400, Andy Spitzer wrote:
> Woof!
> 
> On Thu, 02 Jul 2009 10:28:31 -0400, Arjun Nair <anair1@xxxxxxxxxx> wrote:
> 
> > With the second implementation, even if you do forget to release the  
> > semaphore, it's very likely you'd catch the mistake during testing.
> 
> What always happens is someone later comes along and throws in a
> "return" (or break, or whatever) somewhere in the middle, on some
> obscure error condition that rarely occurs.  In the case of the "auto"
> lock, it gets released, magically.  Without that, the lock release may
> get forgotten.
> 
> Seen this happen too many times to state "it'll get caught in
> testing".  It doesn't.

Which is why doing either of those things is Evil (which does not mean
that I disagree with Woofs preference - I do agree that the OsLock form
is usually better).