changeset 1555:c3b8dedeedc5

Some Audacious specific (for Tuple generation) mutex locks added.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 02 Sep 2007 02:06:06 +0300
parents f7c630358bda
children 16b2bc9b9763 289fa4cb75db
files src/sid/xmms-sid.c
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/sid/xmms-sid.c	Sun Sep 02 01:31:55 2007 +0300
+++ b/src/sid/xmms-sid.c	Sun Sep 02 02:06:06 2007 +0300
@@ -298,10 +298,18 @@
 }
 
 
-static gboolean xs_schedule_subctrl_update( gpointer unused )
+static gboolean xs_schedule_subctrl_update(gpointer unused)
 {
-	if (xs_status.isPlaying == TRUE )
+	(void) unused;
+	gboolean isPlaying;
+	
+	XS_MUTEX_LOCK(xs_status);
+	isPlaying = xs_status.isPlaying;
+	XS_MUTEX_UNLOCK(xs_status);
+
+	if (isPlaying)
 		xs_subctrl_update();
+
 	return FALSE;
 }
 
@@ -964,10 +972,14 @@
 	t_xs_tuneinfo *pInfo;
 	t_xs_tuple *pResult = NULL;
 
+	XS_MUTEX_LOCK(xs_status);
+
 	/* Get tune information from emulation engine */
 	pInfo = xs_status.sidPlayer->plrGetSIDInfo(songFilename);
-	if (!pInfo)
+	if (!pInfo) {
+		XS_MUTEX_UNLOCK(xs_status);
 		return NULL;
+	}
 
 	/* Get sub-tune information, if available */
 	if ((pInfo->startTune > 0) && (pInfo->startTune <= pInfo->nsubTunes)) {
@@ -992,6 +1004,8 @@
 	/* Free tune information */
 	xs_tuneinfo_free(pInfo);
 
+	XS_MUTEX_UNLOCK(xs_status);
+
 	return pResult;
 }