*
* Copyright 2001, 2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 1999, 2000, 2001 Bernie Innocenti <bernie@codewiz.org>
- *
* -->
*
* \brief Semaphore based synchronization services.
*
* \version $Id$
- *
* \author Bernie Innocenti <bernie@codewiz.org>
*/
#include "sem.h"
+#include <cfg/debug.h>
+
+#include <cpu/irq.h> // ASSERT_IRQ_DISABLED()
+
#include <kern/proc.h>
#include <kern/proc_p.h>
#include <kern/signal.h>
-#include <cfg/debug.h>
INLINE void sem_verify(struct Semaphore *s)
{
ASSERT(s->nest_count < 128); // heuristic max
}
-
/**
* \brief Initialize a Semaphore structure.
*/
{
s->nest_count = 1;
s->owner = proc;
- SCHED_ENQUEUE(proc);
+ ATOMIC(SCHED_ENQUEUE(proc));
}
}