hydrogen-music / hydrogen

The advanced drum machine for Linux, macOS, and Windows
http://www.hydrogen-music.org
GNU General Public License v2.0
1.03k stars 172 forks source link

DWD: check whether driver was stopped #1826

Closed theGreatWhiteShark closed 1 year ago

theGreatWhiteShark commented 1 year ago

when using the DiskWriterDriver to export audio and stopping it using AudioEngine::stopAudioDrivers() while the export is still in progress, there is some sort of deadlock. stopAudioDrivers locks the AudioEngine and tells the driver to stop. But in doing so DiskWriterDriver will just wait for the export to complete (which is not right). But in order to export it needs to call the process function of the audio engine and needs to acquire the audio engine lock therein. Now, since this latter will be done using a tryLock and non zero exit code, there is no real deadlock of the AudioEngine. But thread of the DiskWriterDriver is not able to work properly anymore.

Now, stopping the DiskWriterDriver sets a member variable m_bIsRunning which will be checked in the export thread.

addressing #1820