signal: speed up sig_check()
authorarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 14 Mar 2011 12:01:05 +0000 (12:01 +0000)
committerarighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 14 Mar 2011 12:01:05 +0000 (12:01 +0000)
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
bertos/kern/signal.h

index 68abeb8874651a370612432b14865f9261b05950..3fa8d3700cc686f2f499e35a80de28632ddd319d 100644 (file)
 // 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;
index a5d5e8d37e7495805e70277ec034f1bd7f5349d8..2c51f9e8aff07c8e562d6260909e4ee90c693c66 100644 (file)
 #include <cfg/compiler.h>
 #include <cfg/macros.h>    // BV()
 
+#include <cpu/irq.h>
+
 #include <kern/proc.h>
 
 #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)
 {