projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch "preempt" in "trunk".
[bertos.git]
/
bertos
/
kern
/
sem.c
diff --git
a/bertos/kern/sem.c
b/bertos/kern/sem.c
index 7d07f4d6f61585b928e1361186857c0071cca5fd..53ef4cc16cdfec19f33b7bf193a5b0efbee4b6cc 100644
(file)
--- a/
bertos/kern/sem.c
+++ b/
bertos/kern/sem.c
@@
-37,11
+37,13
@@
*/
#include "sem.h"
*/
#include "sem.h"
+#include <cfg/debug.h>
+
#include <cpu/irq.h> // ASSERT_IRQ_DISABLED()
#include <cpu/irq.h> // ASSERT_IRQ_DISABLED()
+
#include <kern/proc.h>
#include <kern/proc_p.h>
#include <kern/signal.h>
#include <kern/proc.h>
#include <kern/proc_p.h>
#include <kern/signal.h>
-#include <cfg/debug.h>
INLINE void sem_verify(struct Semaphore *s)
{
INLINE void sem_verify(struct Semaphore *s)
{
@@
-52,7
+54,6
@@
INLINE void sem_verify(struct Semaphore *s)
ASSERT(s->nest_count < 128); // heuristic max
}
ASSERT(s->nest_count < 128); // heuristic max
}
-
/**
* \brief Initialize a Semaphore structure.
*/
/**
* \brief Initialize a Semaphore structure.
*/
@@
-81,9
+82,9
@@
bool sem_attempt(struct Semaphore *s)
proc_forbid();
sem_verify(s);
proc_forbid();
sem_verify(s);
- if ((!s->owner) || (s->owner ==
CurrentP
rocess))
+ if ((!s->owner) || (s->owner ==
current_p
rocess))
{
{
- s->owner =
CurrentP
rocess;
+ s->owner =
current_p
rocess;
s->nest_count++;
result = true;
}
s->nest_count++;
result = true;
}
@@
-116,10
+117,10
@@
void sem_obtain(struct Semaphore *s)
sem_verify(s);
/* Is the semaphore already locked by another process? */
sem_verify(s);
/* Is the semaphore already locked by another process? */
- if (UNLIKELY(s->owner && (s->owner !=
CurrentP
rocess)))
+ if (UNLIKELY(s->owner && (s->owner !=
current_p
rocess)))
{
/* Append calling process to the wait queue */
{
/* Append calling process to the wait queue */
- ADDTAIL(&s->wait_queue, (Node *)
CurrentP
rocess);
+ ADDTAIL(&s->wait_queue, (Node *)
current_p
rocess);
/*
* We will wake up only when the current owner calls
/*
* We will wake up only when the current owner calls
@@
-134,7
+135,7
@@
void sem_obtain(struct Semaphore *s)
ASSERT(LIST_EMPTY(&s->wait_queue));
/* The semaphore was free: lock it */
ASSERT(LIST_EMPTY(&s->wait_queue));
/* The semaphore was free: lock it */
- s->owner =
CurrentP
rocess;
+ s->owner =
current_p
rocess;
s->nest_count++;
proc_permit();
}
s->nest_count++;
proc_permit();
}
@@
-159,7
+160,7
@@
void sem_release(struct Semaphore *s)
proc_forbid();
sem_verify(s);
proc_forbid();
sem_verify(s);
- ASSERT(s->owner ==
CurrentP
rocess);
+ ASSERT(s->owner ==
current_p
rocess);
/*
* Decrement nesting count and check if the semaphore
/*
* Decrement nesting count and check if the semaphore