diff options
author | Jaroslav Kysela <perex@perex.cz> | 2023-05-03 11:42:35 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2023-05-03 15:59:15 +0200 |
commit | d6d5982d3ae68b72a1a53420b77ac269ef93d40e (patch) | |
tree | b0af7107268cba9301690ca9aff0a65bb8237e14 | |
parent | e2d9e411744dede5a71e04a107cdc0ab7c1d0ed9 (diff) | |
download | alsa-lib-d6d5982d3ae68b72a1a53420b77ac269ef93d40e.tar.gz |
pcm: add SND_PCM_EINTR open mode
Add possibility to return -EINTR instead waiting for the event. The
applications may want to handle -EINTR condition themselves.
BugLink: https://github.com/alsa-project/alsa-lib/issues/228
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r-- | include/pcm.h | 2 | ||||
-rw-r--r-- | src/pcm/pcm.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/pcm.h b/include/pcm.h index 25cd12d1..a29ea980 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -393,6 +393,8 @@ typedef long snd_pcm_sframes_t; #define SND_PCM_NONBLOCK 0x00000001 /** Async notification (flag for open mode) \hideinitializer */ #define SND_PCM_ASYNC 0x00000002 +/** Return EINTR instead blocking (wait operation) */ +#define SND_PCM_EINTR 0x00000080 /** In an abort state (internal, not allowed for open) */ #define SND_PCM_ABORT 0x00008000 /** Disable automatic (but not forced!) rate resamplinig */ diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 01c624d3..41a36b36 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -2938,7 +2938,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout) err_poll = poll(pfd, npfds, timeout); __snd_pcm_lock(pcm->fast_op_arg); if (err_poll < 0) { - if (errno == EINTR && !PCMINABORT(pcm)) + if (errno == EINTR && !PCMINABORT(pcm) && !(pcm->mode & SND_PCM_EINTR)) continue; return -errno; } |