[Scummvm-git-logs] scummvm master -> 2a2351eb2c64363207da59df68d8ad2d733df454

athrxx athrxx at scummvm.org
Sun Aug 25 12:20:42 CEST 2019


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:
d097768e1f AUDIO: (FM-Towns/PC-98) - deconstructor/race condition fix
2a2351eb2c SCI: (FB01 sound driver) - get rid of mutex


Commit: d097768e1fe1d070d75100808543272737dd1e11
    https://github.com/scummvm/scummvm/commit/d097768e1fe1d070d75100808543272737dd1e11
Author: athrxx (athrxx at scummvm.org)
Date: 2019-08-25T11:58:19+02:00

Commit Message:
AUDIO: (FM-Towns/PC-98) - deconstructor/race condition fix

(move mixer calls before mutex lock, since the mixer has a mutex of its own)

Changed paths:
    audio/softsynth/fmtowns_pc98/pc98_audio.cpp
    audio/softsynth/fmtowns_pc98/towns_audio.cpp
    audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp


diff --git a/audio/softsynth/fmtowns_pc98/pc98_audio.cpp b/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
index c8d58f6..9ab1ec7 100644
--- a/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/pc98_audio.cpp
@@ -80,9 +80,9 @@ PC98AudioCoreInternal::PC98AudioCoreInternal(Audio::Mixer *mixer, PC98AudioCore
 }
 
 PC98AudioCoreInternal::~PC98AudioCoreInternal() {
+	deinit();
 	Common::StackLock lock(_mutex);
 	_ready = false;
-	deinit();
 
 	/*
 	
diff --git a/audio/softsynth/fmtowns_pc98/towns_audio.cpp b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
index 1464dd7..58a3a80 100644
--- a/audio/softsynth/fmtowns_pc98/towns_audio.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_audio.cpp
@@ -404,9 +404,9 @@ TownsAudioInterfaceInternal::TownsAudioInterfaceInternal(Audio::Mixer *mixer, To
 }
 
 TownsAudioInterfaceInternal::~TownsAudioInterfaceInternal() {
+	deinit();
 	Common::StackLock lock(_mutex);
 	_ready = false;
-	deinit();
 
 	delete[] _fmSaveReg[0];
 	delete[] _fmSaveReg[1];
diff --git a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
index 178d33e..0cdf183 100644
--- a/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
+++ b/audio/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
@@ -1347,9 +1347,8 @@ int TownsPC98_FmSynth::getRate() const {
 }
 
 void TownsPC98_FmSynth::deinit() {
-	Common::StackLock lock(_mutex);
-	_ready = false;
 	_mixer->stopHandle(_soundHandle);
+	_ready = false;	
 	_timers[0].cb = _timers[1].cb = &TownsPC98_FmSynth::idleTimerCallback;
 }
 


Commit: 2a2351eb2c64363207da59df68d8ad2d733df454
    https://github.com/scummvm/scummvm/commit/2a2351eb2c64363207da59df68d8ad2d733df454
Author: athrxx (athrxx at scummvm.org)
Date: 2019-08-25T11:58:20+02:00

Commit Message:
SCI: (FB01 sound driver) - get rid of mutex

- The mutex was added to avoid the triggering of the assert in backends/midi/windows.cpp, line 95. Meanwhile, this issue has been addressed differently.
- SCI does not per se require a mutex for the sound drivers. The engine is mostly thread-safe by avoiding driver calls through the main thread.

Changed paths:
    engines/sci/sound/drivers/fb01.cpp


diff --git a/engines/sci/sound/drivers/fb01.cpp b/engines/sci/sound/drivers/fb01.cpp
index 7f163a5..3be7650 100644
--- a/engines/sci/sound/drivers/fb01.cpp
+++ b/engines/sci/sound/drivers/fb01.cpp
@@ -74,8 +74,6 @@ public:
 	void playSwitch(bool play);
 
 	bool isOpen() const { return _isOpen; }
-	void lockMutex() { _mutex.lock(); }
-	void unlockMutex() { _mutex.unlock(); }
 
 	const char *reportMissingFiles() { return _missingFiles; }
 
@@ -133,7 +131,6 @@ private:
 	int _numParts;
 
 	bool _isOpen;
-	Common::Mutex _mutex;
 
 	Channel _channels[16];
 	Voice _voices[kVoices];
@@ -161,7 +158,6 @@ MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _pla
 MidiPlayer_Fb01::~MidiPlayer_Fb01() {
 	if (_driver)
 		_driver->setTimerCallback(NULL, NULL);
-	Common::StackLock lock(_mutex);
 	close();
 	delete _driver;
 }
@@ -510,8 +506,6 @@ void MidiPlayer_Fb01::midiTimerCallback(void *p) {
 
 	MidiPlayer_Fb01 *m = (MidiPlayer_Fb01 *)p;
 
-	m->lockMutex();
-
 	if (!m->isOpen())
 		return;
 
@@ -523,12 +517,9 @@ void MidiPlayer_Fb01::midiTimerCallback(void *p) {
 
 	if (m->_timerProc)
 		m->_timerProc(m->_timerParam);
-
-	m->unlockMutex();
 }
 
 void MidiPlayer_Fb01::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
-	Common::StackLock lock(_mutex);
 	_driver->setTimerCallback(NULL, NULL);
 
 	_timerParam = timer_param;
@@ -640,7 +631,6 @@ int MidiPlayer_Fb01::open(ResourceManager *resMan) {
 void MidiPlayer_Fb01::close() {
 	if (_driver)
 		_driver->setTimerCallback(NULL, NULL);
-	Common::StackLock lock(_mutex);
 	_isOpen = false;
 	if (_driver)
 		_driver->close();





More information about the Scummvm-git-logs mailing list