## semaphore_destroy

Function - Destroy a semaphore.

### SYNOPSIS

    kern_return_t   semaphore_destroy
                    (task_t                                    task,
                     semaphore_t                          semaphore);

### PARAMETERS

task
  [in task port] The task associated with the target semaphore.

semaphore
  [in send right] The port naming the semaphore to be destroyed.

### DESCRIPTION

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.

### RETURN VALUES

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.

### RELATED INFORMATION

Functions: semaphore_create, semaphore_signal, semaphore_signal_all, semaphore_wait, device_get_status.