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

Re: [sipX-dev] Critical sections


Woof!

On Wed, 01 Jul 2009 15:55:49 -0400, Dale Worley <dworley@xxxxxxxxxx> wrote:

There are two common implementations of critical sections in sipXecs:
       OsBSem semaphore;
        ...
        {
            OsLock lock(semaphore);
            <critical section>;
        }
        ...
and

        OsMutex semaphore;
        ...
        semaphore.acquire();
        <critical section>;
        semaphore.release();
Is one preferable to the other?

I much prefer the first one, as there is no way to exit the block without 
releasing the semaphore (the magic of C++ and auto variables)

--Woof!