sem_unlink()
QNX SDP8.0C Library ReferenceAPIDeveloper
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.
 - ENAMETOOLONG
 - The length of the sem_name argument exceeds PATH_MAX.
 - ENOENT
 - The semaphore sem_name doesn't exist.
 
Classification:
| Safety: | |
|---|---|
| Cancellation point | No | 
| Signal handler | Yes | 
| Thread | Yes | 
Page updated: 
