mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05:00
fixed the handling of EINTR in read/write.
EINTR can be returned during ACPI suspend/resume.
This commit is contained in:
parent
64a39728a2
commit
494f3e66e4
3 changed files with 22 additions and 6 deletions
|
|
@ -265,6 +265,22 @@ int snd_pcm_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t *info);
|
|||
int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int shmid);
|
||||
int _snd_pcm_poll_descriptor(snd_pcm_t *pcm);
|
||||
|
||||
/* handle special error cases */
|
||||
static inline int snd_pcm_check_error(snd_pcm_t *pcm, int err)
|
||||
{
|
||||
if (err == -EINTR) {
|
||||
switch (snd_pcm_state(pcm)) {
|
||||
case SND_PCM_STATE_XRUN:
|
||||
return -EPIPE;
|
||||
case SND_PCM_STATE_SUSPENDED:
|
||||
return -ESTRPIPE;
|
||||
case SND_PCM_STATE_DISCONNECTED:
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
static inline snd_pcm_uframes_t snd_pcm_mmap_playback_avail(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_sframes_t avail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue