diff options
author | John Hawthorn <john@hawthorn.email> | 2018-09-15 14:11:02 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2018-09-23 11:23:53 -0700 |
commit | 83e6fedf9b4c436a4adbdc136d5617a783a1e1e8 (patch) | |
tree | d5d8f41e72538d3716e104c9fd19387b77d02590 /src | |
parent | 76e5f30d19b0d9306a192d48ebad3d17a29bc3cf (diff) |
Switch to pselect
Diffstat (limited to 'src')
-rw-r--r-- | src/tty.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); } |