From cad585e9ddb3a488f6ed81a3671d97cf8e940c66 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Thu, 13 Jun 2013 18:14:21 +0200 Subject: [PATCH] remove context switch in native lpm_sleep quick fix for now --- cpu/native/lpm_cpu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/cpu/native/lpm_cpu.c b/cpu/native/lpm_cpu.c index 45a5e01bc..0c70de916 100644 --- a/cpu/native/lpm_cpu.c +++ b/cpu/native/lpm_cpu.c @@ -22,6 +22,7 @@ #include #include #endif +#include #include "lpm.h" #include "debug.h" @@ -46,21 +47,15 @@ void _native_lpm_sleep() retval = select(1, &_native_uart_rfds, NULL, NULL, NULL); DEBUG("_native_lpm_sleep: retval: %i\n", retval); if (retval != -1) { - /* uart ready, swap to ISR context and handle input */ - makecontext(_native_isr_ctx, _native_handle_uart0_input, 0); - swapcontext((ucontext_t*)(active_thread->sp), _native_isr_ctx); + /* uart ready, handle input */ + /* TODO: switch to ISR context */ + _native_handle_uart0_input(); } - else if ((retval == -1) && (errno == EINTR)) { - /* TODO: reevaluate and merge with above branch - * IF any thread except the idle thread uses lpm_set this could make sense... */ - /* select interrupted by signal swap to ISR context and handle input */ - DEBUG("\n\n\t\treturn from interrupted syscall, swapping context and calling _native_handle_uart0_input\n\n"); - makecontext(_native_isr_ctx, _native_handle_uart0_input, 0); - swapcontext(_native_cur_ctx, _native_isr_ctx); - } - else { + else if (errno != EINTR) { + /* select failed for reason other than signal */ err(1, "lpm_set(): select()"); } + /* otherwise select was interrupted because of a signal, continue below */ #else pause(); #endif