sem_unlink()

remove a named semaphore 

Realtime Function


SYNOPSIS

#include <semaphore.h>

int sem_unlink(const char *name);


DESCRIPTION

The sem_unlink() function removes the specified named semaphore. If other process are currently referencing the specified semaphore, sem_unlink() has no effect on the state of the semaphore. If one or more processes have the specified semaphore open when you call sem_unlink(), the semaphore is not removed until all references to the semaphore has been destroyed by sem_close(), _exit(), or exec() calls. Calls to sem_open() to re-create or re-connect to the specified semaphore refer to a new semaphore after sem_unlink() is called. The sem_unlink() call does not block until all references have been destroyed; it returns immediately.


PARAMETERS

name 

Specifies the semaphore to be removed.


RETURN VALUES

When the sem_unlink() is successful, it returns 0. Otherwise, the semaphore is unchanged, the function returns -1, and sets errno to one of the following values:

EACCES 

Permission is denied to remove the named semaphore.

ENAMETOOLONG 

The length of the name string is greater than NAME_MAX while POSIX_NO_TRUNC is in effect.

ENOENT 

The named semaphore does not exist.


EXAMPLES

None.


CONFORMANCE

UNIX 03. Derived from the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995)


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
sem_close(), sem_open(), semctl(), semget(), semop()

Miscellaneous:
semaphores


PTC MKS Toolkit 10.3 Documentation Build 39.