esound r520 - trunk
- From: jmouette svn gnome org
- To: svn-commits-list gnome org
- Subject: esound r520 - trunk
- Date: Tue, 18 Nov 2008 20:26:26 +0000 (UTC)
Author: jmouette
Date: Tue Nov 18 20:26:26 2008
New Revision: 520
URL: http://svn.gnome.org/viewvc/esound?rev=520&view=rev
Log:
* esddsp.c: (dsp_init): Protect dsp_init() with a mutex to
prevent race conditions from multiple calls (which hanged the
desktop session).
Modified:
trunk/ChangeLog
trunk/esddsp.c
Modified: trunk/esddsp.c
==============================================================================
--- trunk/esddsp.c (original)
+++ trunk/esddsp.c Tue Nov 18 20:26:26 2008
@@ -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;
@@ -158,6 +164,7 @@
DPRINTF ("mixer settings file: %s\n", mixer);
}
}
+ pthread_mutex_unlock(&mutex);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]