From 9de969006ba55ceba5e0f4e548ab6a2c4a79a494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 Oct 2004 15:54:47 +0000 Subject: [PATCH] Added two experimental release_sem_etc() flags (both should stay, but they may be renamed): - B_RELEASE_ALL: the semaphore count is set to 0, all waiting threads are released (the "count" argument of release_etc_sem() is ignored then) - B_RELEASE_IF_WAITING_ONLY: the semaphore count is only decreased if there are any waiting threads; ie. the semaphore is signaled Together, they will make the pthread_cond_*() functions easy to implement, and they come in handy at other places, too. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9329 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/kernel/OS.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/headers/os/kernel/OS.h b/headers/os/kernel/OS.h index 2282f99012..bc7feba83a 100644 --- a/headers/os/kernel/OS.h +++ b/headers/os/kernel/OS.h @@ -145,8 +145,12 @@ typedef struct sem_info { /* semaphore flags */ enum { B_CAN_INTERRUPT = 1, /* acquisition of the semaphore can be interrupted (system use only) */ - B_DO_NOT_RESCHEDULE = 2, /* thread is not rescheduled after release_sem_etc() */ B_CHECK_PERMISSION = 4, /* ownership will be checked (system use only) */ + + /* release_sem_etc() only flags */ + B_DO_NOT_RESCHEDULE = 2, /* thread is not rescheduled */ + B_RELEASE_ALL = 8, /* all waiting threads will be woken up, count will be zeroed */ + B_RELEASE_IF_WAITING_ONLY = 16, /* release count only if there are any threads waiting */ }; extern sem_id create_sem(int32 count, const char *name);