X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fsignal.c;h=2b3a191fe06b7a94194d45e9adc142b511cffcf2;hb=e8b0472be10fba4ca6baa62d8d483db90e28c06e;hp=3fa8d3700cc686f2f499e35a80de28632ddd319d;hpb=42469af0705dcaaa8fa7341392716cd8d4d625da;p=bertos.git diff --git a/bertos/kern/signal.c b/bertos/kern/signal.c index 3fa8d370..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); @@ -246,16 +245,6 @@ INLINE void __sig_signal(Signal *s, Process *proc, sigmask_t sigs, bool wakeup) IRQ_RESTORE(flags); } -/** - * Send the signals \a sigs to the process \a proc and immeditaly dispatch it - * for execution. - * - * The process will be awoken if it was waiting for any of them and immediately - * dispatched for execution. - * - * \note This function can't be called from IRQ context, use sig_post() - * instead. - */ void sig_sendSignal(Signal *s, Process *proc, sigmask_t sigs) { ASSERT_USER_CONTEXT(); @@ -265,12 +254,6 @@ void sig_sendSignal(Signal *s, Process *proc, sigmask_t sigs) __sig_signal(s, proc, sigs, true); } -/** - * Send the signals \a sigs to the process \a proc. - * The process will be awoken if it was waiting for any of them. - * - * \note This call is interrupt safe. - */ void sig_postSignal(Signal *s, Process *proc, sigmask_t sigs) { __sig_signal(s, proc, sigs, false);