osfmk/man/lock_acquire.html
Function - Acquire access rights to a lock.
**kern\_return\_t lock\_acquire**** (lock\_set\_t **lock\_set,** int **lock\_id** );**
lock_set[in send right] The port naming the lock set which represents the lock.
lock_id[in scalar] The lock, represented by the lock set, to be acquired.
The lock_acquire function acquires access rights to a specific lock being represented by a given lock set. If the lock is already controlled by another thread then the calling thread will block.
KERN_SUCCESS The lock was acquired.
KERN_INVALID_ARGUMENT The specified lock set is invalid, or the lock id is out of range.
KERN_LOCK_UNSTABLE The acquired lock has an unstable state.
KERN_LOCK_SET_DESTROYED The specified lock has been destroyed.
KERN_ABORTED While blocked to wait for the specified lock to become available, the calling thread was awoken by an unrelated event, such as thread termination.
Functions: lock_release, lock_try, lock_handoff, lock_handoff_accept, lock_make_stable, lock_set_create, lock_set_destroy.