mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
PCM direct plugins - handle EINTR in the resource server
The poll() call in the resource server for PCM direct plugins might be interrupted with an signal. Handle the case gracefuly and don't exit the server (which brings another problems - cannot connect to socket - later).
This commit is contained in:
parent
ea77e08cc6
commit
f1acd7726c
1 changed files with 6 additions and 2 deletions
|
|
@ -288,9 +288,13 @@ static void server_job(snd_pcm_direct_t *dmix)
|
|||
server_printf("DIRECT SERVER STARTED\n");
|
||||
while (1) {
|
||||
ret = poll(pfds, current + 1, 500);
|
||||
server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x\n", ret, pfds[0].revents);
|
||||
if (ret < 0) /* some error */
|
||||
server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x, errno = %i\n", ret, pfds[0].revents, errno);
|
||||
if (ret < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
/* some error */
|
||||
break;
|
||||
}
|
||||
if (ret == 0 || (pfds[0].revents & (POLLERR | POLLHUP))) { /* timeout or error? */
|
||||
struct shmid_ds buf;
|
||||
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue