summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2018-09-15 14:11:02 -0700
committerJohn Hawthorn <john@hawthorn.email>2018-09-23 11:23:53 -0700
commit83e6fedf9b4c436a4adbdc136d5617a783a1e1e8 (patch)
treed5d8f41e72538d3716e104c9fd19387b77d02590 /src
parent76e5f30d19b0d9306a192d48ebad3d17a29bc3cf (diff)
Switch to pselect
Diffstat (limited to 'src')
-rw-r--r--src/tty.c6
1 files 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);
}