Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > aaf0b19f16ae7f802f953c316417e14b > files > 2

esound-0.2.40-1mdv2009.0.src.rpm

--- esound-0.2.38.orig/esddsp.c
+++ esound-0.2.38/esddsp.c
@@ -26,6 +26,8 @@
 
 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 
+#define _GNU_SOURCE 1
+
 #ifdef DSP_DEBUG
 #define DPRINTF(format, args...)	printf(format, ## args)
 #else
@@ -45,6 +47,7 @@
 #include <sys/time.h>
 #include <stdio.h>
 #include <errno.h>
+#include <pthread.h>
 
 #ifdef HAVE_MACHINE_SOUNDCARD_H
 #  include <machine/soundcard.h>
@@ -124,9 +127,12 @@
 }
 
 
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+
 static void
 dsp_init (void)
 {
+  pthread_mutex_lock(&mutex);
   if (!ident)
     {
       const char *str;
@@ -157,6 +163,7 @@
 	  DPRINTF ("mixer settings file: %s\n", mixer);
 	}
     }
+  pthread_mutex_unlock(&mutex);
 }
 
 static void