aboutsummaryrefslogtreecommitdiffstats
path: root/src/output/alsa_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-04-21 22:47:12 +0200
committerMax Kellermann <max@duempel.org>2009-04-21 22:47:12 +0200
commit85658965c929b668dd5f75e5571654c488fca297 (patch)
tree624dc0cffee86d4c0624b07ff4cde99d32926293 /src/output/alsa_plugin.c
parenteb059a789c1018367c80a5344ccfd834c27fa3d3 (diff)
downloadmpd-85658965c929b668dd5f75e5571654c488fca297.tar.gz
mpd-85658965c929b668dd5f75e5571654c488fca297.tar.xz
mpd-85658965c929b668dd5f75e5571654c488fca297.zip
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().
Diffstat (limited to '')
-rw-r--r--src/output/alsa_plugin.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 0295742e2..818c83ca2 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -136,15 +136,8 @@ alsa_init(G_GNUC_UNUSED const struct audio_format *audio_format,
const struct config_param *param,
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();
- if (!free_global_registered) {
- atexit((void(*)(void))snd_config_update_free_global);
- free_global_registered = 1;
- }
-
alsa_configure(ad, param);
return ad;
@@ -156,6 +149,9 @@ alsa_finish(void *data)
struct alsa_data *ad = data;
alsa_data_free(ad);
+
+ /* free libasound's config cache */
+ snd_config_update_free_global();
}
static bool