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
This commit is contained in:
Axel Dörfler 2004-10-13 15:54:47 +00:00
parent 1956e69d13
commit 9de969006b

View File

@ -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);