X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fsignal.h;h=2c51f9e8aff07c8e562d6260909e4ee90c693c66;hb=42469af0705dcaaa8fa7341392716cd8d4d625da;hp=a5d5e8d37e7495805e70277ec034f1bd7f5349d8;hpb=523c070f86a34c68404a3c2451c150e6f9c3f6f2;p=bertos.git diff --git a/bertos/kern/signal.h b/bertos/kern/signal.h index a5d5e8d3..2c51f9e8 100644 --- a/bertos/kern/signal.h +++ b/bertos/kern/signal.h @@ -51,12 +51,38 @@ #include #include // BV() +#include + #include #if CONFIG_KERN_SIGNALS -/* Inter-process Communication services */ -sigmask_t sig_checkSignal(Signal *s, sigmask_t sigs); +INLINE sigmask_t __sig_checkSignal(Signal *s, sigmask_t sigs) +{ + sigmask_t result; + + result = s->recv & sigs; + s->recv &= ~sigs; + + return result; +} + +/** + * Check if any of the signals in \a sigs has occurred and clear them. + * + * \return the signals that have occurred. + */ +INLINE sigmask_t sig_checkSignal(Signal *s, sigmask_t sigs) +{ + cpu_flags_t flags; + sigmask_t result; + + IRQ_SAVE_DISABLE(flags); + result = __sig_checkSignal(s, sigs); + IRQ_RESTORE(flags); + + return result; +} INLINE sigmask_t sig_check(sigmask_t sigs) {