sem_unlink()

Destroy a named semaphore

Synopsis:

#include <semaphore.h>

int sem_unlink( const char * sem_name );

Arguments:

sem_name
The name of the semaphore that you want to destroy.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

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.

Returns:

0
Success.
-1
An error occurred (errno is set).

Errors:

EACCES
You don't have permission to unlink the semaphore.
ELOOP
Too many levels of symbolic links or prefixes.
ENOENT
The semaphore sem_name doesn't exist.
ENAMETOOLONG
The sem_name argument is longer than (NAME_MAX - 8).
ENOSYS
The sem_unlink() function isn't implemented for the filesystem specified in path.

Classification:

POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes