Use a better name.
[bertos.git] / bertos / kern / signal.c
index d4fe178ed75567c21348dc72b1665eb477a608a3..dbe1261f2053381e7a4127e67ee084504f00bca3 100644 (file)
 
 #include "signal.h"
 
-#include <cfg/cfg_timer.h>
+#include "cfg/cfg_timer.h"
 #include <cfg/debug.h>
+#include <cfg/depend.h>
+
 #include <cpu/irq.h>
 #include <kern/proc.h>
 #include <kern/proc_p.h>
 
 #if CONFIG_KERN_SIGNALS
 
+// Check config dependencies
+CONFIG_DEPEND(CONFIG_KERN_SIGNALS, CONFIG_KERN);
+
 /**
  * Check if any of the signals in \a sigs has occurred and clear them.
  *
 sigmask_t sig_check(sigmask_t sigs)
 {
        sigmask_t result;
-       cpuflags_t flags;
+       cpu_flags_t flags;
 
        IRQ_SAVE_DISABLE(flags);
        result = CurrentProcess->sig_recv & sigs;
@@ -135,12 +140,11 @@ sigmask_t sig_check(sigmask_t sigs)
 sigmask_t sig_wait(sigmask_t sigs)
 {
        sigmask_t result;
-       cpuflags_t flags;
-       extern int preempt_forbid_cnt;
+       cpu_flags_t flags;
 
        /* Sleeping with IRQs disabled or preemption forbidden is illegal */
        IRQ_ASSERT_ENABLED();
-       ASSERT(preempt_forbid_cnt == 0);
+       ASSERT(proc_preemptAllowed());
 
        /*
         * This is subtle: there's a race condition where a concurrent
@@ -203,7 +207,7 @@ sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout)
 {
        Timer t;
        sigmask_t res;
-       cpuflags_t flags;
+       cpu_flags_t flags;
 
        ASSERT(!sig_check(SIG_TIMEOUT));
        ASSERT(!(sigs & SIG_TIMEOUT));
@@ -234,7 +238,7 @@ sigmask_t sig_waitTimeout(sigmask_t sigs, ticks_t timeout)
  */
 void sig_signal(Process *proc, sigmask_t sigs)
 {
-       cpuflags_t flags;
+       cpu_flags_t flags;
 
        /* See comment in sig_wait() for why this protection is necessary */
        IRQ_SAVE_DISABLE(flags);