Re: [sipX-dev] Critical sections
- From: "Andy Spitzer" <woof@xxxxxxxxx>
- Date: Wed, 01 Jul 2009 16:05:31 -0400
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!