Skip to content

Commit

Permalink
cpu: native: work around shared errno in _native_lpm_sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspar030 committed Jul 8, 2015
1 parent 1e262e3 commit 52599fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpu/native/lpm_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void _native_lpm_sleep(void)

_native_in_syscall++; // no switching here
nfds = real_select(nfds, &_native_rfds, NULL, NULL, NULL);
int _errno = errno;
_native_in_syscall--;

DEBUG("_native_lpm_sleep: returned: %i\n", nfds);
Expand All @@ -64,15 +65,15 @@ void _native_lpm_sleep(void)
/* TODO: switch to ISR context */
_native_handle_uart0_input();
}
else if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) {
else if ((_errno == EAGAIN) || (_errno == EWOULDBLOCK)) {
/* would block / resource unavailable .. it appears a
* contended socket can show this behavior sometimes */
_native_in_syscall++;
warn("_native_lpm_sleep: select()");
_native_in_syscall--;
return;
}
else if (errno != EINTR) {
else if (_errno != EINTR) {
/* select failed for reason other than signal */
err(EXIT_FAILURE, "lpm_set(): select()");
}
Expand Down

0 comments on commit 52599fd

Please sign in to comment.