alsa_output: don't use atexit() to clean up the ALSA library

Call snd_config_update_free_global() manually in our finish() method,
don't use atexit().
This commit is contained in:
Max Kellermann 2009-04-21 22:47:12 +02:00
parent eb059a789c
commit 85658965c9

View File

@ -136,15 +136,8 @@ alsa_init(G_GNUC_UNUSED const struct audio_format *audio_format,
const struct config_param *param, const struct config_param *param,
G_GNUC_UNUSED GError **error) G_GNUC_UNUSED GError **error)
{ {
/* no need for pthread_once thread-safety when reading config */
static int free_global_registered;
struct alsa_data *ad = alsa_data_new(); struct alsa_data *ad = alsa_data_new();
if (!free_global_registered) {
atexit((void(*)(void))snd_config_update_free_global);
free_global_registered = 1;
}
alsa_configure(ad, param); alsa_configure(ad, param);
return ad; return ad;
@ -156,6 +149,9 @@ alsa_finish(void *data)
struct alsa_data *ad = data; struct alsa_data *ad = data;
alsa_data_free(ad); alsa_data_free(ad);
/* free libasound's config cache */
snd_config_update_free_global();
} }
static bool static bool