Added a benaphore_lock_etc() for a timeout possibility.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3690 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-06-27 16:39:33 +00:00
parent 15cfed465c
commit 749df8aa6b
1 changed files with 10 additions and 0 deletions

View File

@ -61,6 +61,16 @@ extern void mutex_unlock(mutex *m);
extern status_t benaphore_init(benaphore *ben, const char *name);
extern void benaphore_destroy(benaphore *ben);
static inline status_t
benaphore_lock_etc(benaphore *ben, uint32 flags, bigtime_t timeout)
{
if (atomic_add(&ben->count, -1) <= 0)
return acquire_sem_etc(ben->sem, 1, flags, timeout);
return B_OK;
}
static inline status_t
benaphore_lock(benaphore *ben)
{