X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fsignal.c;h=2b3a191fe06b7a94194d45e9adc142b511cffcf2;hb=57fa5e371a8b40afc99b922731b77d17c55330a4;hp=26805b5fdd79328e0de5b6a3d0283d7813712b47;hpb=505448bf486b73df77f0fc8a3b596f35657602b5;p=bertos.git diff --git a/bertos/kern/signal.c b/bertos/kern/signal.c index 26805b5f..2b3a191f 100644 --- a/bertos/kern/signal.c +++ b/bertos/kern/signal.c @@ -191,13 +191,9 @@ sigmask_t sig_waitSignal(Signal *s, sigmask_t sigs) #if CONFIG_TIMER_EVENTS #include -/** - * Sleep until any of the signals in \a sigs or \a timeout ticks elapse. - * If the timeout elapse a SIG_TIMEOUT is added to the received signal(s). - * \return the signal(s) that have awoken the process. - * \note Caller must check return value to check which signal awoke the process. - */ -sigmask_t sig_waitTimeoutSignal(Signal *s, sigmask_t sigs, ticks_t timeout) + +sigmask_t sig_waitTimeoutSignal(Signal *s, sigmask_t sigs, ticks_t timeout, + Hook func, iptr_t data) { Timer t; sigmask_t res; @@ -208,7 +204,10 @@ sigmask_t sig_waitTimeoutSignal(Signal *s, sigmask_t sigs, ticks_t timeout) /* IRQ are needed to run timer */ ASSERT(IRQ_ENABLED()); - timer_set_event_signal(&t, proc_current(), SIG_TIMEOUT); + if (func) + timer_setSoftint(&t, func, data); + else + timer_set_event_signal(&t, proc_current(), SIG_TIMEOUT); timer_setDelay(&t, timeout); timer_add(&t); res = sig_waitSignal(s, SIG_TIMEOUT | sigs);