Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly terminate stuck audio thread when closing the program #155

Merged
merged 7 commits into from
Aug 25, 2022

Conversation

nyanpasu64
Copy link
Collaborator

@nyanpasu64 nyanpasu64 commented Aug 3, 2022

I observed the audio thread to get stuck waiting for room to write audio, on a Windows 7 machine with an stuck audio daemon (audiodg.exe). It happens intermittently due to either bad apps, a broken audiodg.exe or APO plugin, or bad sound drivers (not sure which).

To make it work, I had to switch CSoundGen to shared_ptr ownership, which is an improvement to code maintainability in general (avoids the possibility of dangling pointers). This is a prerequisite for future refactorings.

I also fixed the audio thread burning CPU when audio isn't running (due to no audio devices, an audio initialization error, etc.).

This should be correct? I'm not confident lol

I observed the audio thread to get stuck waiting for room to write
audio, on a Windows 7 machine with an stuck audio daemon
(audiodg.exe). It happens intermittently due to either bad apps, a
broken audiodg.exe or APO plugin, or bad sound drivers (not sure
which).
…undGen

Previously the audio thread closed and nulled out
CSoundGen::m_hInterruptEvent when exiting, which would cause a data
race or use-after-free when trying to set it afterwards from the GUI
thread.
This prevents UAF when interrupting the thread during program shutdown.
@Gumball2415 Gumball2415 merged commit 4f01fd6 into master Aug 25, 2022
@nyanpasu64 nyanpasu64 deleted the shared-ptr-csoundgen branch March 13, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants