forked from github/abduco
Use pselect instead of select
For the server case I see no such race condition.
This commit is contained in:
parent
eabb140a38
commit
2de1946f1a
8
client.c
8
client.c
|
|
@ -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");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue