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

Luigi Rizzo rizzo at icir.org
Fri Dec 30 08:14:54 MST 2005


On Fri, Dec 30, 2005 at 09:02:02AM -0600, Tilghman Lesher wrote:
> On Friday 30 December 2005 07:12, Luigi Rizzo wrote:
> > I think the proper course of action is to wrap the atomic ops
> > into macros, and then let the common header implement the
> > locking in the proper way, with fallback to the above
> > sequence only for unknown architectures.
> >
> > FreeBSD (and i suppose linux as well) has example code
> > for i386 and others in the machine/atomic.[ch] files
> 
> This appears to be FreeBSD-specific (or BSD-specific).  There are
> no such macros on Linux.

still... one example suffices :)

if we are using to use __builtin_expect()
to save a few cycles on refcount mamipulations (see astobj.h)
it would make a lot more sense (and save a lot more cycles)
to save the expensive ast_mutex lock/unlock ops
around those manipulations. At least for i386, the relevant
code is trivial.

usecount has similar issues.

Kevin/Mark, any interest on this ?

	cheers
	luigi



More information about the asterisk-dev mailing list