Updated: April 19, 2023 |
Destroy a named semaphore
#include <semaphore.h> int sem_unlink( const char * sem_name );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The sem_unlink() function destroys the named semaphore, sem_name. Open semaphores are removed the same way that unlink() removes open files; the processes that have the semaphore open can still use it, but the semaphore will disappear as soon as the last process uses sem_close() to close it.
Any attempt to use sem_open() on an unlinked semaphore will refer to a new semaphore.
Semaphores are persistent as long as the system remains up.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |