[Asterisk-Dev] Race issue in channel.c involving uniqueint on Asterisk 1.2.1

Luigi Rizzo rizzo at icir.org
Fri Jan 6 20:19:53 MST 2006


On Fri, Jan 06, 2006 at 12:41:39PM -0800, Luigi Rizzo wrote:
> On Fri, Jan 06, 2006 at 01:27:15PM -0600, Kevin P. Fleming wrote:
> > Luigi Rizzo wrote:
...
> 
> (2) We do not need to rely on the system's headers, we can provide our own
> implementation as shown at the end. It's 1 assembly instruction derived
> from a bsd implementation, but i would bet that it appears on tons
> of documentation all over the place and i doubt one could argue licensing
> issues in this, or we would have trouble with any individual C statement.
> 
> (1) In terms of this you can implement the atomic_dec_and_test() as
> 
> 	int atomic_dec_and_test(volatile int *p)
> 	{
> 		int a = atomic_dec_and_test(&p, 1);

ouch, i meant	int a = ast_atomic_fetchadd_int(&p, -1);

cheers
luigi



More information about the asterisk-dev mailing list