[linux-audio-dev] mutex in process callback?

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

Subject: [linux-audio-dev] mutex in process callback?
From: Lukas Degener (AFBLukas_AT_gmx.de)
Date: Thu Mar 27 2003 - 15:55:37 EET


Hi LADs,
here is a problem that maybe very common with many rt audio apps, so
hopefully there is a "standard" solution for it?

assume jack process callback reads audio data from a buffer, while
another thread might alter the
contents of this buffer. In my particular scenario, i will actualy use
doublebuffering. So the only operation that needs to be "mutexed"
is the actual swapping of front and back buffers (well, pointers, of
course, not the contents)

Now my problem is: How can i make sure that swapping does not accure
during process (playback) callback?

I could use a mutex, but this might also block the playback thread. (if
swapping is in process when the jack callback is invoked)

On the other hand, swapping pointers shouldn't take that long, so maybe
this would not be a problem?

Or would it make sense to try and "foresee" such a situation and avoid
it by delaying the swapping?

Any clever suggestions on this?

Regards,
Lukas


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

This archive was generated by hypermail 2b28 : Thu Mar 27 2003 - 16:02:38 EET