From f197107a3dcb606a8e0f1a9ba2bdd86a9c9893f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 14 Oct 2004 14:37:39 +0000 Subject: [PATCH] B_RELEASE_ALL is now a bit faster if it has nothing to do. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9349 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/sem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/kernel/core/sem.c b/src/kernel/core/sem.c index dfa7b26ebe..dcddf86666 100644 --- a/src/kernel/core/sem.c +++ b/src/kernel/core/sem.c @@ -562,9 +562,14 @@ release_sem_etc(sem_id id, int32 count, uint32 flags) // order in sem_interrupt_thread. releaseQueue.head = releaseQueue.tail = NULL; - if (flags & B_RELEASE_ALL) + if (flags & B_RELEASE_ALL) { count = -gSems[slot].u.used.count; + // is there anything to do for us at all? + if (count == 0) + goto err; + } + while (count > 0) { int delta = count; if (gSems[slot].u.used.count < 0) {