-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
native_midi: Use non-blocking mode and polling
When stopping a song we must wait for the playback thread to terminate. However, the thread may currently be doing a blocking write of some MIDI events and we don't actually know how long this may take to complete. Instead, we can use non-blocking mode and the poll() system call. This allows us to sleep when the output event buffer is full, but also allows us to wake it back up when it's time for the song to stop. We accomplish this by creating a pipe that we close on shutdown.
- Loading branch information
Showing
1 changed file
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters