From 3c16e8426f566774e085ba0c9cccee8dcb8de633 Mon Sep 17 00:00:00 2001 From: Yonezawa-T2 Date: Tue, 17 May 2016 11:08:19 +0900 Subject: [PATCH] native: add timeout for select. Fixes #5442 --- cpu/native/async_read.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpu/native/async_read.c b/cpu/native/async_read.c index e99b6ac32a..12ee95999b 100644 --- a/cpu/native/async_read.c +++ b/cpu/native/async_read.c @@ -42,6 +42,8 @@ static void _async_io_isr(void) { int max_fd = 0; + struct timeval timeout = { .tv_usec = 0 }; + for (int i = 0; i < _next_index; i++) { FD_SET(_fds[i], &rfds); @@ -50,7 +52,7 @@ static void _async_io_isr(void) { } } - if (real_select(max_fd + 1, &rfds, NULL, NULL, NULL) > 0) { + if (real_select(max_fd + 1, &rfds, NULL, NULL, &timeout) > 0) { for (int i = 0; i < _next_index; i++) { if (FD_ISSET(_fds[i], &rfds)) { _native_async_read_callbacks[i](_fds[i]);