1 2#include "lock.h" 3 4int 5beos_new_lock(beos_lock *l, const char *name) 6{ 7 if (!l) 8 return B_BAD_VALUE; 9 10 l->s = create_sem(0, name); 11 if (l->s < 0) 12 return l->s; 13 14 l->c = 1; 15 return B_OK; 16} 17 18int 19beos_free_lock(beos_lock *l) 20{ 21 if (!l) 22 return B_BAD_VALUE; 23 24 delete_sem(l->s); 25 return 0; 26} 27 28int 29beos_new_mlock(beos_mlock *l, long c, const char *name) 30{ 31 if (!l) 32 return B_BAD_VALUE; 33 34 l->s = create_sem(c, name); 35 if (l->s < 0) 36 return l->s; 37 38 return B_OK; 39} 40 41int 42beos_free_mlock(beos_mlock *l) 43{ 44 if (!l) 45 return B_BAD_VALUE; 46 47 delete_sem(l->s); 48 return 0; 49} 50 51