[Scummvm-tracker] [ScummVM :: Bugs] #12617: AGOS: Deadlock when shutting down game, at least with the MT-32 emulator

ScummVM :: Bugs trac at scummvm.org
Fri Jun 11 09:47:08 UTC 2021


#12617: AGOS: Deadlock when shutting down game, at least with the MT-32 emulator
-------------------------+--------------------------
Reporter:  eriktorbjorn  |      Owner:  (none)
    Type:  defect        |     Status:  new
Priority:  normal        |  Component:  Engine: AGOS
 Version:                |   Keywords:
    Game:                |
-------------------------+--------------------------
 I've noticed several times that when I shut down an AGOS games that uses
 the MT-32 emulator, it deadlocks. Of course, such problems can be tricky
 to debug. I think the sequence of events goes like this:

 1. AGOS::~MidiPlayer() is called, but has not yet had the time to lock
 _mutex.
 2. The audio thread calls AGOS::MidiPlayer::onTimer(), which has not yet
 had the time to lock _mutex.
 3. ~MidiPlayer() locks _mutex, leaving onTimer() waiting.
 4. ~MidiPlayer() calls _driver->close()
 5. MidiDriver_MT32::close() calls _mixer->stopHandle() which never
 terminates.

 I ''think'' stopHandle() may be waiting for readBuffer() to finish, but it
 never does because onTimer() is blocked. But I'm not quite sure.

 I've seen this happen with the DOS talkie version of Simon the Sorcerer 1,
 and I also had it lock up with Elvira 2, probably for the same reason.
-- 
Ticket URL: <https://bugs.scummvm.org/ticket/12617>
ScummVM :: Bugs <https://bugs.scummvm.org>
ScummVM


More information about the Scummvm-tracker mailing list