[LAU] Linux audio app design: The nature of xruns

lanas lanas at securenet.net
Mon Dec 28 14:19:35 EST 2009


Le Lundi, 28 Décembre 2009 16:00:04 +0100,
Dominic Sacré <dominic.sacre at gmx.de> a écrit :

> The rules are quite simple, but in many cases not exactly easy to 
> implement.

> Inside the JACK process callback, you may not call anything that
> might block, i.e. that might suspend the calling thread indefinitely.
> That includes:
> - memory allocations (and deallocations)
> - waiting for mutexes etc.
> - file IO, printing to the console, etc.

Thanks for the pointers.  For me this does not consitute any problem.
Such callbacks must be treated like, if I may make the analogy, the
bottom part of an ISR.

> The main difficulty lies in the fact that these things are often
> hidden deep inside some library code. So you should either verify
> that a function is safe to use in realtime code, or avoid using it in
> this context.

Yes.  It is better to set context and return from such callbacks
as soon as possible.  Then some kind of observer, free of such time
contraints, would react on the set context variables/structures.  

> As for common solutions to these problems, the link to the previous 
> thread David posted should be a good start.

Thanks to David also. I'll start reading the JACK API.  Looks
interesting from a programming point of view.

Cheers/Salut/Tschüß




More information about the Linux-audio-user mailing list