[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Any plans for glib to contain atomic compare/exchange?



On Wed, 30 Jul 2003, Mike Hearn wrote:

> interrupt the comparison/exchange/increment halfway through, and the bus
> assert prevents other CPUs from interfering also.
>
> These are very handy for implementing thread safe reference counts,
> termination signals/variables, linked lists and so on without the use of
> an explicit mutex. That makes them more convenient and higher
> performance.

In order to get those things right on non-x86 SMP architectures, wouldn't
you also need to put memory barrier functions/macros into glib?

(and wouldn't it be too hard to do for most "programmers" anyway?  Those
precious few who can do it right can probably do it without glib --
probably the easiest way is to steal/adapt similar code from the Linux
kernel)

-Peter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]