On Mon, 3 Dec 2001, Alexander Ehlert wrote: > Hi, > > can it be, that snd_pcm_open in the alsa lib is not threadsafe?
You're right, the snd_config_update() function is not thread safe (it uses global variables). I put this item to the todo list. > Glame uses threads for all its plugins and if I have for example > one audio_in and one audio_out plugin, it can happen, that > snd_pcm_open is called twice at the same time. Wonderful things > happen in snd_config_expand and glame can't open any audio devices > with alsa for a running session. Putting mutexes around snd_pcm_open > fixes the problem. Are there any other functions in the alsa lib > that are potentially not thread safe? Other functions should be thread safe (except pcm_share plugin), because they are using different handlers and data structures. Only functions operating with the ring buffer (snd_pcm_write*/snd_pcm_read*) and setting parameters (snd_pcm_hw_params, snd_pcm_sw_params) should be called only from one thread, otherwise a data inconsistency situation can be occured. I'm speaking about same snd_pcm_t handle, if handles are different, there is no problem to call all mentioned functions simultaneously. Jaroslav ----- Jaroslav Kysela <[EMAIL PROTECTED]> SuSE Linux http://www.suse.com ALSA Project http://www.alsa-project.org _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel