From e05dacc96872c22d234af216d0728e46e8e222e0 Mon Sep 17 00:00:00 2001 From: bernie Date: Thu, 21 Oct 2004 10:48:57 +0000 Subject: [PATCH] sem_release(): Simplify (made by rasky on scfirm). git-svn-id: https://src.develer.com/svnoss/bertos/trunk@255 38d2e660-2303-0410-9eaa-f027e97ec537 --- kern/sem.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/kern/sem.c b/kern/sem.c index 9e5905f6..2262cb08 100755 --- a/kern/sem.c +++ b/kern/sem.c @@ -15,6 +15,9 @@ /*#* *#* $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 *#* @@ -141,20 +144,19 @@ void sem_release(struct Semaphore *s) DISABLE_IRQSAVE(flags); /* - * Decremement nesting count and check if the semaphore + * Decrement nesting count and check if the semaphore * has been fully unlocked */ if (--s->nest_count == 0) { + Process *proc; + /* 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); -- 2.25.1