projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sem_release(): Simplify (made by rasky on scfirm).
[bertos.git]
/
kern
/
sem.c
diff --git
a/kern/sem.c
b/kern/sem.c
index 9e5905f6ae4db7c34777c0a5b7d04d752ef03d97..2262cb081d8306693cc13036903c1d0a4f92f69f 100755
(executable)
--- a/
kern/sem.c
+++ b/
kern/sem.c
@@
-15,6
+15,9
@@
/*#*
*#* $Log$
/*#*
*#* $Log$
+ *#* Revision 1.5 2004/10/21 10:48:57 bernie
+ *#* sem_release(): Simplify (made by rasky on scfirm).
+ *#*
*#* Revision 1.4 2004/08/25 14:12:09 rasky
*#* Aggiornato il comment block dei log RCS
*#*
*#* Revision 1.4 2004/08/25 14:12:09 rasky
*#* Aggiornato il comment block dei log RCS
*#*
@@
-141,20
+144,19
@@
void sem_release(struct Semaphore *s)
DISABLE_IRQSAVE(flags);
/*
DISABLE_IRQSAVE(flags);
/*
- * Decreme
me
nt nesting count and check if the semaphore
+ * Decrement nesting count and check if the semaphore
* has been fully unlocked
*/
if (--s->nest_count == 0)
{
* has been fully unlocked
*/
if (--s->nest_count == 0)
{
+ Process *proc;
+
/* Disown semaphore */
s->owner = NULL;
/* Disown semaphore */
s->owner = NULL;
- /*
Anybody still waiting for this semaphore?
*/
- if (
!ISLISTEMPTY(&s->wait_queue
))
+ /*
Give semaphore to the first applicant, if any
*/
+ if (
(proc = (Process*)REMHEAD(&s->wait_queue)
))
{
{
- /* Give semaphore to the first applicant */
- Process *proc = (Process *)s->wait_queue.head;
- REMOVE((Node *)proc);
s->nest_count = 1;
s->owner = proc;
SCHED_ENQUEUE(proc);
s->nest_count = 1;
s->owner = proc;
SCHED_ENQUEUE(proc);