| ... | ... |
@@ -91,10 +91,12 @@ char tty_getchar(tty_t *tty) {
|
| 91 | 91 |
|
| 92 | 92 |
int tty_input_ready(tty_t *tty, unsigned long timeout) {
|
| 93 | 93 |
fd_set readfs; |
| 94 |
- struct timeval tv = {timeout / 1000, (timeout % 1000) * 1000};
|
|
| 95 | 94 |
FD_ZERO(&readfs); |
| 96 | 95 |
FD_SET(tty->fdin, &readfs); |
| 97 |
- select(tty->fdin + 1, &readfs, NULL, NULL, &tv); |
|
| 96 |
+ |
|
| 97 |
+ struct timespec ts = {timeout / 1000, (timeout % 1000) * 1000000};
|
|
| 98 |
+ |
|
| 99 |
+ pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL); |
|
| 98 | 100 |
return FD_ISSET(tty->fdin, &readfs); |
| 99 | 101 |
} |
| 100 | 102 |
|