Lines Matching refs:ben
14 static status_t benaphore_create( const char *name, benaphore_t *ben );
15 static status_t benaphore_destroy( benaphore_t *ben );
16 static status_t benaphore_lock( benaphore_t *ben );
17 static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros );
18 static status_t benaphore_unlock( benaphore_t *ben );
20 static status_t benaphore_create( const char *name, benaphore_t *ben ) in benaphore_create() argument
22 if( ben != NULL ) { in benaphore_create()
23 ben->_atom = 0; in benaphore_create()
24 ben->_sem = create_sem( 0, name ); in benaphore_create()
26 if( ben->_sem < B_NO_ERROR ) { in benaphore_create()
36 static status_t benaphore_destroy( benaphore_t *ben ) in benaphore_destroy() argument
38 if( ben->_sem >= B_NO_ERROR ) { in benaphore_destroy()
39 status_t retval = benaphore_timedlock( ben, 0 ); in benaphore_destroy()
42 status_t del_retval = delete_sem( ben->_sem ); in benaphore_destroy()
51 static status_t benaphore_lock( benaphore_t *ben ) in benaphore_lock() argument
53 int32 prev = atomic_add( &(ben->_atom), 1 ); in benaphore_lock()
56 return acquire_sem( ben->_sem ); in benaphore_lock()
62 static status_t benaphore_timedlock( benaphore_t *ben, bigtime_t micros ) in benaphore_timedlock() argument
64 int32 prev = atomic_add( &(ben->_atom), 1 ); in benaphore_timedlock()
67 status_t retval = acquire_sem_etc( ben->_sem, 1, B_TIMEOUT, micros ); in benaphore_timedlock()
86 static status_t benaphore_unlock( benaphore_t *ben ) in benaphore_unlock() argument
88 int32 prev = atomic_add( &(ben->_atom), -1 ); in benaphore_unlock()
91 return release_sem( ben->_sem ); in benaphore_unlock()