aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorGregory Montoir2007-12-02 14:34:33 +0000
committerGregory Montoir2007-12-02 14:34:33 +0000
commit1a2d4c9c28e0c44fbf6f5af936e7a59a9e1ebc45 (patch)
tree5a4b0db148705fc43bba9144ce54aefdc9df9a3d /engines
parent55a24b3b321660e492e44cdbc642d3405f164af8 (diff)
downloadscummvm-rg350-1a2d4c9c28e0c44fbf6f5af936e7a59a9e1ebc45.tar.gz
scummvm-rg350-1a2d4c9c28e0c44fbf6f5af936e7a59a9e1ebc45.tar.bz2
scummvm-rg350-1a2d4c9c28e0c44fbf6f5af936e7a59a9e1ebc45.zip
revised mutex handling a bit in dimuse :
- protected access to Track.used in startSound - removed mutex lock in cloneToFadeOutTrack as it's always called with mutex already locked on (shouldn't change anything, though, due to mutex re-entrancy) svn-id: r29705
Diffstat (limited to 'engines')
-rw-r--r--engines/scumm/imuse_digi/dimuse_track.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/engines/scumm/imuse_digi/dimuse_track.cpp b/engines/scumm/imuse_digi/dimuse_track.cpp
index 86570f478d..383c0281df 100644
--- a/engines/scumm/imuse_digi/dimuse_track.cpp
+++ b/engines/scumm/imuse_digi/dimuse_track.cpp
@@ -80,12 +80,17 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
}
Track *track = _track[l];
- while (track->used) {
+ while (1) {
+ _mutex.lock();
+ if (!track->used) {
+ break;
+ }
// The designated track is not yet available. So, we call flushTracks()
// to get it processed (and thus made ready for us). Since the actual
// processing is done by another thread, we also call parseEvents to
// give it some time (and to avoid busy waiting/looping).
flushTracks();
+ _mutex.unlock();
#ifndef __PLAYSTATION2__
_vm->parseEvents();
#endif
@@ -186,6 +191,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
}
track->used = true;
+ _mutex.unlock();
}
void IMuseDigital::setPriority(int soundId, int priority) {
@@ -309,7 +315,6 @@ void IMuseDigital::fadeOutMusic(int fadeDelay) {
}
IMuseDigital::Track *IMuseDigital::cloneToFadeOutTrack(const Track *track, int fadeDelay) {
- Common::StackLock lock(_mutex, "IMuseDigital::cloneToFadeOutTrack()");
assert(track);
Track *fadeTrack = 0;