[Scummvm-git-logs] scummvm master -> 2803adc0b82f0e260fd25281719529373c3096bb
bluegr
noreply at scummvm.org
Fri Jun 3 20:42:06 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2ef6e24e56 SCI: avoid deadlocks by using only one mutex
2803adc0b8 SCI: update mutex comment
Commit: 2ef6e24e569cefd3e99198c5ed6f374fd0c8bb7a
https://github.com/scummvm/scummvm/commit/2ef6e24e569cefd3e99198c5ed6f374fd0c8bb7a
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-03T23:42:02+03:00
Commit Message:
SCI: avoid deadlocks by using only one mutex
Make use of the mixer's mutex instead of creating a new one. Otherwise there can still be lock-ups when the main thread and the mixer thread lock each other up in different mutexes (causing a deadlock/freeze). I just noticed this with KQ5 FM-Towns.
We had the same issue in AGOS, it was fixed by allowing to access the mixer's mutex. We can use the same thing here...
Changed paths:
engines/sci/sound/music.cpp
engines/sci/sound/music.h
diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp
index a5d0720451d..d62afe79473 100644
--- a/engines/sci/sound/music.cpp
+++ b/engines/sci/sound/music.cpp
@@ -39,7 +39,7 @@
namespace Sci {
SciMusic::SciMusic(SciVersion soundVersion, bool useDigitalSFX)
- : _soundVersion(soundVersion), _soundOn(true), _masterVolume(15), _globalReverb(0), _useDigitalSFX(useDigitalSFX), _needsResume(soundVersion > SCI_VERSION_0_LATE), _globalPause(0) {
+ : _mutex(g_system->getMixer()->mutex()), _soundVersion(soundVersion), _soundOn(true), _masterVolume(15), _globalReverb(0), _useDigitalSFX(useDigitalSFX), _needsResume(soundVersion > SCI_VERSION_0_LATE), _globalPause(0) {
// Reserve some space in the playlist, to avoid expensive insertion
// operations
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 3fd988d69da..38f0f005984 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -261,7 +261,7 @@ public:
// MIDI parser and to the MIDI driver/player. Note that guarded code must NOT
// include references to the mixer, otherwise there will probably be situations
// where a deadlock can occur
- Common::Mutex _mutex;
+ Common::Mutex &_mutex;
protected:
void sortPlayList();
Commit: 2803adc0b82f0e260fd25281719529373c3096bb
https://github.com/scummvm/scummvm/commit/2803adc0b82f0e260fd25281719529373c3096bb
Author: athrxx (athrxx at scummvm.org)
Date: 2022-06-03T23:42:02+03:00
Commit Message:
SCI: update mutex comment
(after turning _mutex into a reference to the mixers's mutex)
Changed paths:
engines/sci/sound/music.h
diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h
index 38f0f005984..68e11eddff9 100644
--- a/engines/sci/sound/music.h
+++ b/engines/sci/sound/music.h
@@ -258,9 +258,9 @@ public:
void saveLoadWithSerializer(Common::Serializer &ser) override;
// Mutex for music code. Used to guard access to the song playlist, to the
- // MIDI parser and to the MIDI driver/player. Note that guarded code must NOT
- // include references to the mixer, otherwise there will probably be situations
- // where a deadlock can occur
+ // MIDI parser and to the MIDI driver/player. We use a reference to
+ // the mixer's internal mutex to avoid deadlocks which sometimes occur when
+ // different threads lock each other up in different mutexes.
Common::Mutex &_mutex;
protected:
More information about the Scummvm-git-logs
mailing list