# HG changeset patch # User Matti Hamalainen # Date 1104073141 0 # Node ID e6dec620b1b3c278de87a31ebf361db5f8b94c39 # Parent 3cd7e6f91b8ad69e05d450c5705d57d7bea52bde Improved locking, still some unlocked parts left, but nothing dangerous. diff -r 3cd7e6f91b8a -r e6dec620b1b3 src/xmms-sid.c --- a/src/xmms-sid.c Sun Dec 26 13:01:04 2004 +0000 +++ b/src/xmms-sid.c Sun Dec 26 14:59:01 2004 +0000 @@ -344,13 +344,13 @@ doPlay = TRUE; while (xs_status.isPlaying && doPlay) { + /* Automatic sub-tune change logic */ + XS_MUTEX_LOCK(xs_cfg); XS_MUTEX_LOCK(xs_status); assert(xs_status.currSong >= 1); assert(xs_status.currSong <= XS_STIL_MAXENTRY); myStatus.isPlaying = TRUE; - XS_MUTEX_UNLOCK(xs_status); - /* Automatic sub-tune change logic */ if (xs_cfg.subAutoEnable && (myStatus.currSong == xs_status.currSong)) { /* Check if currently selected sub-tune has been played already */ @@ -372,7 +372,8 @@ if (!playedTune[i]) isFound = TRUE; } - + + /* currSong = i + 1 anyway, so we get it free here */ i++; } @@ -380,22 +381,22 @@ { /* Set the new sub-tune */ XSDEBUG("found #%i\n", i); - XS_MUTEX_LOCK(xs_status); xs_status.currSong = i; - XS_MUTEX_UNLOCK(xs_status); } else /* This is the end */ doPlay = FALSE; + XS_MUTEX_UNLOCK(xs_status); + XS_MUTEX_UNLOCK(xs_cfg); continue; /* This is ugly, but ... */ } } /* Tell that we are initializing, update sub-tune controls */ - XS_MUTEX_LOCK(xs_status); myStatus.currSong = xs_status.currSong; + playedTune[myStatus.currSong - 1] = TRUE; XS_MUTEX_UNLOCK(xs_status); - playedTune[myStatus.currSong - 1] = TRUE; + XS_MUTEX_UNLOCK(xs_cfg); XSDEBUG("subtune #%i selected, initializing...\n", myStatus.currSong);