fixed the handling of EINTR in read/write.

EINTR can be returned during ACPI suspend/resume.
This commit is contained in:
Takashi Iwai 2004-04-15 12:22:26 +00:00
parent 64a39728a2
commit 494f3e66e4
3 changed files with 22 additions and 6 deletions

View file

@ -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;