[alsa-devel] pcm write from posix threads

Brian Rhodes bgr at acdstar.com
Wed Aug 20 00:24:06 CEST 2008


When calling snd_pcm_write* from a thread how do you safely cancel the 
thread?  I've tried masking the signals which are used in alsa lib, yet 
I am getting a segfault on pthread_exit().  My thread is looping doing 
the following.

testcancel
snd_pcm_wait
snd_pcm_avail
snd_pcm_writei

I am checking return values to handle those functions being woken up by 
pthread cancel and attempting to exit.  In testing the process it 
performs fine until I start actually writing data.  Once I write some 
data, a pthread_exit will segfault.  My cancellation routine is calling 
snd_pcm_drop, then doing a cancel followed by join.


More information about the Alsa-devel mailing list