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

AlsaSequencer does not get properly disposed when AlsaMidiInput is disposed #78

Open
SebDaMuffin opened this issue Jan 25, 2024 · 0 comments

Comments

@SebDaMuffin
Copy link

SebDaMuffin commented Jan 25, 2024

When calling AlsaMidiInput.Dispose() or AlsaMidiInput.CloseInputAsync(), the underlying AlsaSequencer keeps a thread alive via a task running EventLoop() that never completes. In order to dispose properly, it should call AlsaSequencer.StopListening(), wait for the event loop to complete, then dispose the rest of the resources. It's important to wait for the event loop to finish before calling AlsaSequencer.Dispose(), because AlsaSequencer.Dispose() makes the event loop hang as it's polling for data. I am unable to compile the solution on my end on linux so I'm using reflection to perform these actions. By using this method, I can confirm that the thread is no longer alive after AlsaMidiInput.Dispose().

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

No branches or pull requests

1 participant