Use pselect instead of select

For the server case I see no such race condition.
This commit is contained in:
Marc André Tanner 2014-10-16 21:41:17 +02:00
parent eabb140a38
commit 2de1946f1a
1 changed files with 7 additions and 1 deletions

View File

@ -33,6 +33,12 @@ static void client_restore_terminal(void) {
} }
static int client_mainloop(void) { static int client_mainloop(void) {
sigset_t emptyset, blockset;
sigemptyset(&emptyset);
sigemptyset(&blockset);
sigaddset(&blockset, SIGWINCH);
sigprocmask(SIG_BLOCK, &blockset, NULL);
client.need_resize = true; client.need_resize = true;
Packet pkt = { Packet pkt = {
.type = MSG_ATTACH, .type = MSG_ATTACH,
@ -60,7 +66,7 @@ static int client_mainloop(void) {
} }
} }
if (select(server.socket + 1, &fds, NULL, NULL, NULL) == -1) { if (pselect(server.socket+1, &fds, NULL, NULL, NULL, &emptyset) == -1) {
if (errno == EINTR) if (errno == EINTR)
continue; continue;
die("client-mainloop"); die("client-mainloop");