![]() |
![]() |
![]() |
Set or reset the block behavior
#include <sys/asoundlib.h> int snd_pcm_nonblock_mode( snd_pcm_t * handle, int nonblock );
libasound.so
The snd_pcm_nonblock_mode() function sets up block (default) or nonblock behavior for a handle.
Block behavior suspends the execution of a program when there's no room left in the buffer when you're writing, or nothing left to read from when you're reading.
In nonblock behavior, programs aren't suspended and the above functions return immediately with the count of bytes which were read or written by the driver. When used in this way, don't try to use the entire buffer after the call, but instead process the number of bytes returned, and call the function again.
See the example in Opening your audio device in the Playing audio data chapter.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
![]() |
![]() |
![]() |