osfmk/man/semaphore_destroy.html
Function - Destroy a semaphore.
**kern\_return\_t semaphore\_destroy**** (task\_t **task,** semaphore\_t **semaphore** );**
task[in task port] The task associated with the target semaphore.
semaphore[in send right] The port naming the semaphore to be destroyed.
The semaphore_destroy function destroys a semaphore. All send rights naming the semaphore become dead names. Threads waiting on the semaphore become unblocked with the return from the semaphore_wait call indicating that the semaphore was destroyed. A call to semaphore_destroy succeeds only if the semaphore is associated with the specified task.
KERN_INVALID_ARGUMENT Either, or both, the task or semaphore arguments were invalid.
KERN_INVALID_RIGHT The specified task does not own the specified semaphore.
KERN_TERMINATED The specified semaphore was previously destroyed.
KERN_SUCCESS The semaphore was destroyed.
Functions: semaphore_create, semaphore_signal, semaphore_signal_all, semaphore_wait, device_get_status.