* pcm write from posix threads
@ 2008-08-19 22:24 Brian Rhodes
2008-08-20 8:11 ` Takashi Iwai
0 siblings, 1 reply; 3+ messages in thread
From: Brian Rhodes @ 2008-08-19 22:24 UTC (permalink / raw)
To: alsa-devel
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pcm write from posix threads
2008-08-19 22:24 pcm write from posix threads Brian Rhodes
@ 2008-08-20 8:11 ` Takashi Iwai
2008-08-20 8:39 ` Brian Rhodes
0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2008-08-20 8:11 UTC (permalink / raw)
To: Brian Rhodes; +Cc: alsa-devel
At Tue, 19 Aug 2008 17:24:06 -0500,
Brian Rhodes wrote:
>
> 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.
No, alsa-lib functions don't care threads in general.
Some codes have uses pthread_mutex, but not in the PCM core code, at
least.
You need to handle and protect threads by yourself.
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: pcm write from posix threads
2008-08-20 8:11 ` Takashi Iwai
@ 2008-08-20 8:39 ` Brian Rhodes
0 siblings, 0 replies; 3+ messages in thread
From: Brian Rhodes @ 2008-08-20 8:39 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
Thanks for reassuring me that there isn't some sort of incompatibility
with alsa lib and threading. I am not able to reproduce the issue on an
x86 system and it only seems to happen when built with a specific
toolchain for ARM.
Takashi Iwai wrote:
> At Tue, 19 Aug 2008 17:24:06 -0500,
> Brian Rhodes wrote:
>
>> 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.
>>
>
> No, alsa-lib functions don't care threads in general.
> Some codes have uses pthread_mutex, but not in the PCM core code, at
> least.
>
> You need to handle and protect threads by yourself.
>
>
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-08-20 8:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-19 22:24 pcm write from posix threads Brian Rhodes
2008-08-20 8:11 ` Takashi Iwai
2008-08-20 8:39 ` Brian Rhodes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.