Re: [LAD] Atomic Operations

From: <fons@email-addr-hidden>
Date: Mon Dec 14 2009 - 23:54:15 EET

On Mon, Dec 14, 2009 at 02:45:38PM -0500, Stephen Sinclair wrote:

> I didn't read the others, but I looked at this one and I think it's
> important to point out some problems with it. He is claiming that you
> cannot increment an integer atomically, which is true, but this
> doesn't mean that the reads and writes, by themselves, are not atomic
> operations.

True. OTOH having devoted cq. wasted part of my life
programming SPARC machines I can confirm Paul Davis'
comment on those: sig_atomic_t on these machines was
24 bits. But I *never* understood how on earth they
managed to create this anomaly on what was after all
a full 32-bit architecture.

A simple pattern I use to avoid the incr/decr problem
is to use two variables, each one of them being modified
(incremented) by only one thread. Instead of testing for
zero test for equality.

Ciao,

-- 
FA
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Tue Dec 15 00:15:07 2009

This archive was generated by hypermail 2.1.8 : Tue Dec 15 2009 - 00:15:07 EET