[LAD] Best practice for sharing complex data structures with a jack callback function

Fons Adriaensen fons at kokkinizita.net
Sat Jul 7 09:31:04 UTC 2007


On Sat, Jul 07, 2007 at 02:44:31AM +0200, Lars Luthman wrote:
> On Sat, 2007-07-07 at 02:34 +0200, Fons Adriaensen wrote:
> > * The callback has to know when it can (re)write the object.
> >   Clearly it should never wait on a sema, and it is already
> >   periodic, so here you can use a flag in the object. 
> 
> Is there any advantage in using a simple flag instead of a semaphore and
> sem_trywait()?

It even simpler, and polling may be easier than finding a way to
wait both on the sema and some other condition.

If you never use wait() and always trywait(), then the sema just
is a counter.

-- 
FA

Follie! Follie! Delirio vano è questo !





More information about the Linux-audio-dev mailing list