mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	control, pcm: implement snd_ctl_abort() and snd_pcm_abort() functions
Upon an interrupt, it is necessary to abort the wait loops with the EINTR error code. Introduce snd_*_abort() functions to handle this case. Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
		
							parent
							
								
									730c833dd8
								
							
						
					
					
						commit
						e23fb2c4de
					
				
					 7 changed files with 17 additions and 4 deletions
				
			
		|  | @ -716,7 +716,7 @@ int snd_pcm_close(snd_pcm_t *pcm) | |||
| /**
 | ||||
|  * \brief set nonblock mode | ||||
|  * \param pcm PCM handle | ||||
|  * \param nonblock 0 = block, 1 = nonblock mode | ||||
|  * \param nonblock 0 = block, 1 = nonblock mode, 2 = abort | ||||
|  * \return 0 on success otherwise a negative error code | ||||
|  */ | ||||
| int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock) | ||||
|  | @ -725,6 +725,10 @@ int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock) | |||
| 	assert(pcm); | ||||
| 	if ((err = pcm->ops->nonblock(pcm->op_arg, nonblock)) < 0) | ||||
| 		return err; | ||||
| 	if (nonblock == 2) { | ||||
| 		pcm->mode |= SND_PCM_ABORT; | ||||
| 		return 0; | ||||
| 	} | ||||
| 	if (nonblock) | ||||
| 		pcm->mode |= SND_PCM_NONBLOCK; | ||||
| 	else { | ||||
|  | @ -2401,7 +2405,7 @@ int snd_pcm_wait_nocheck(snd_pcm_t *pcm, int timeout) | |||
| 	do { | ||||
| 		err_poll = poll(pfd, npfds, timeout); | ||||
| 		if (err_poll < 0) { | ||||
| 		        if (errno == EINTR) | ||||
| 		        if (errno == EINTR && !PCMINABORT(pcm)) | ||||
| 		                continue; | ||||
| 			return -errno; | ||||
|                 } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jaroslav Kysela
						Jaroslav Kysela