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:
parent
15cfed465c
commit
749df8aa6b
@ -61,6 +61,16 @@ extern void mutex_unlock(mutex *m);
|
|||||||
extern status_t benaphore_init(benaphore *ben, const char *name);
|
extern status_t benaphore_init(benaphore *ben, const char *name);
|
||||||
extern void benaphore_destroy(benaphore *ben);
|
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
|
static inline status_t
|
||||||
benaphore_lock(benaphore *ben)
|
benaphore_lock(benaphore *ben)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user