From 83e6fedf9b4c436a4adbdc136d5617a783a1e1e8 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 15 Sep 2018 14:11:02 -0700 Subject: Switch to pselect --- src/tty.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tty.c b/src/tty.c index 38a9f2f..c84606e 100644 --- a/src/tty.c +++ b/src/tty.c @@ -91,10 +91,12 @@ char tty_getchar(tty_t *tty) { int tty_input_ready(tty_t *tty, unsigned long timeout) { fd_set readfs; - struct timeval tv = {timeout / 1000, (timeout % 1000) * 1000}; FD_ZERO(&readfs); FD_SET(tty->fdin, &readfs); - select(tty->fdin + 1, &readfs, NULL, NULL, &tv); + + struct timespec ts = {timeout / 1000, (timeout % 1000) * 1000000}; + + pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL); return FD_ISSET(tty->fdin, &readfs); } -- cgit v1.2.3