Multithreaded Programming Guide

Destroy the Semaphore State

Use sema_destroy(3C) to destroy any state that is associated with the semaphore pointed to by sp. The space for storing the semaphore is not freed.

sema_destroy(3C) Syntax

#include <thread.h>

int sema_destroy(sema_t *sp);

sema_destroy(3C) Return Values

sema_destroy() returns 0 if successful. When the following condition is detected, sema_destroy() fails and returns the corresponding value.



sp refers to an invalid semaphore.