[alsa-devel] Unblock MIDI IN in blocking read mode

Florian alsa at bome.com
Thu Apr 12 00:05:54 CEST 2007


Hi,

for best performance, I use a blocking snd_rawmidi_read() on an ALSA
MIDI input device, byte by byte. It works fine, except:

1) How do I close the device from a different thread? I.e. how can I
unblock the blocking read() call when it's time to close the device
and no MIDI data is currently coming in?
Just calling snd_rawmidi_close() will cause a crash. Using
snd_rawmidi_drop() did not release the blocking read() in the other
thread.

2) How is a blocking read() typically implemented in the ALSA MIDI
driver? Maybe I can resort to non-blocking mode and avoid the
situation above.

Thanks,
Florian


-- 
Florian Bomers
bome.com

-------------------------------------------------------
Music Software, Development Tools:  http://www.bome.com
Java Sound extensions, plugins: http://www.tritonus.org
The Java Sound Resources:    http://www.jsresources.org
-------------------------------------------------------
Please quote this email in your reply. Thanks!


More information about the Alsa-devel mailing list