The sem_destroy function destroys an unnamed semaphore indicated by sem. Only a semaphore created using sem_init may be destroyed using sem_destroy. The potential for deadlock exists if a process calls sem_destroy for a semaphore while there is a pending sem_wait, because a process may be waiting for a poster that has not yet opened the semaphore.