mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 14:03:55 +01:00
Merge pull request #5446 from Yonezawa-T2/native_select_timeout
native: add timeout for select. Fixes #5442
This commit is contained in:
commit
d6663d950c
@ -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]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user