Lines Matching refs:lock
15 typedef struct lock {
18 } lock;
22 init_lock(struct lock *lock, const char *name)
24 lock->sem = create_sem(0, name);
25 lock->count = 0;
27 return lock->sem < B_OK ? lock->sem : B_OK;
32 uninit_lock(struct lock *lock)
34 delete_sem(lock->sem);
39 acquire_lock(struct lock *lock)
41 if (atomic_add(&lock->count, 1) > 0)
42 return acquire_sem(lock->sem);
49 release_lock(struct lock *lock)
51 if (atomic_add(&lock->count, -1) > 1)
52 return release_sem(lock->sem);
60 Autolock(struct lock &lock)
62 fLock(&lock)
81 struct lock *fLock;