Re: [linux-audio-dev] atomic xchg

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] atomic xchg
From: Bill Gribble (grib_AT_cs.utexas.edu)
Date: to loka   14 1999 - 19:00:57 EDT


Benno Senoner <sbenno_AT_gardena.net> writes:
> On Thu, 14 Oct 1999, Paul Barton-Davis wrote:
> > yep. when an engine thread is writing to a set of output buffers, and
> > another thread is reading from a different set of output buffers, i'd
> > like to able to atomically swap the pointers to the buffer sets
> > without a lock whenever the reader thread is all done. something like
> > that.

Why is it so important to do it without a lock? Mutexes just aren't
that expensive, and you WILL end up shooting yourself in the foot if
you try to get by without them. You're talking about swapping
pointers in a double-buffered workspace... the amount of time to do
the "work" is going to far overwhelm the time to do a piddly
pthread_mutex_lock() / swap pointers / pthread_mutex_unlock().

> Paul make sure that we have a fallback solution (compile time) for CPU
> architectures which do not provide these specialized asm instructions,
> since it would be nice to run our audio engine on any powerful Linux
> architecture ( Alpha, G4 PPC etc).

...which is the best reason to use a standard API (POSIX threads) and
don't depend on hardware-specific tricks.

Bill Gribble


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:27:59 EST