[alsa-devel] [Re: Crash when snd_pcm_open is called from a thread with "pulse" as playback]

Nicolas.Castagne at imag.fr Nicolas.Castagne at imag.fr
Sun Mar 8 17:11:45 CET 2009


Hi folks,

I'd need the help of some alsa developpers regarding the bug report :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426

We've made a few progress on it, but we are stuck again.

Basically, it seems that calling snd_config_update_free_global() from a
pthread causes the program to crash when the thread terminates.



Questions are:

Should config_update_free_global NOT be called from a thread ?

In other words, is the following code valid (though dumb :=)) ?
Or is there some reason for it to crash ?



**********************************
#include <pthread.h>
#include <alsa/asoundlib.h>
void * threadWork(void *arg) {
    snd_pcm_t *playback_handle;
    if (snd_pcm_open (&playback_handle, "default",
SND_PCM_STREAM_PLAYBACK, 0) < 0)
        fprintf (stderr, "error\n";
    snd_pcm_close(playback_handle);

    snd_config_update_free_global();
    return NULL;
}
int main() {
    pthread_attr_t attr;
    pthread_attr_init(&attr);
    pthread_t threadid;
    pthread_create( &threadid, &attr, threadWork, NULL);
    return EXIT_SUCCESS;
}
**********************************


I thank you much,

Nicolas





---------------------------- Message original ----------------------------
Objet:    Crash when snd_pcm_open is called from a thread with "pulse" as 
    playback
De:       castagne at imag.fr
Date:     Mer 4 mars 2009 8:20
À:       alsa-devel at alsa-project.org
--------------------------------------------------------------------------

Hi folks,

I hope I post on the correct mail list...
I've read somewhere that I should report bugs on a list, and not only on
the Tracker. That's the aim of this message.


On all my Fedora 10 machines,
whenever
       snd_pcm_open
has been called from a pthread using "pulse" as playback
then the program crashes when the thread terminates.

Crash in __nptl_deallocate_tsd

However, AFAIK, one should be able to call snd_pcm_open from a thread.

The full bug report is there, with a very simple sample code :
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4426

I think this bug relates directly to alsa.
I hope this report is useful.


Best-
Nicolas




More information about the Alsa-devel mailing list