From 42469af0705dcaaa8fa7341392716cd8d4d625da Mon Sep 17 00:00:00 2001 From: arighi Date: Mon, 14 Mar 2011 12:01:05 +0000 Subject: [PATCH] signal: speed up sig_check() Always inline sig_checkSignal() and provide a "faster" IRQ-less version __sig_checkSignal(), available for the internal BeRTOS core components. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4766 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/kern/signal.c | 23 ----------------------- bertos/kern/signal.h | 30 ++++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/bertos/kern/signal.c b/bertos/kern/signal.c index 68abeb88..3fa8d370 100644 --- a/bertos/kern/signal.c +++ b/bertos/kern/signal.c @@ -141,29 +141,6 @@ // Check config dependencies CONFIG_DEPEND(CONFIG_KERN_SIGNALS, CONFIG_KERN); -/** - * Check if any of the signals in \a sigs has occurred and clear them. - * - * \return the signals that have occurred. - */ -sigmask_t sig_checkSignal(Signal *s, sigmask_t sigs) -{ - sigmask_t result; - cpu_flags_t flags; - - IRQ_SAVE_DISABLE(flags); - result = s->recv & sigs; - s->recv &= ~sigs; - IRQ_RESTORE(flags); - - return result; -} - - -/** - * Sleep until any of the signals in \a sigs occurs. - * \return the signal(s) that have awoken the process. - */ sigmask_t sig_waitSignal(Signal *s, sigmask_t sigs) { sigmask_t result; 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) { -- 2.25.1