Removes the specified named semaphore. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <semaphore.h> int sem_unlink (const char *name);
1 – Argument
name The name of the semaphore to remove.
2 – Description
The sem_unlink function removes a semaphore named by the name string. If the semaphore is referenced by other processes, sem_ unlink does not change the state of the semaphore. If other processes have the semaphore open when sem_unlink is called, the semaphore is not destroyed until all references to the semaphore have been destroyed by calls to sem_close. The sem_ unlink function returns immediately; it does not wait until all references have been destroyed. Calls to sem_open to recreate or reconnect to the semaphore refer to a new semaphore after sem_unlink is called.
3 – Return Values
0 Successful completion. The function executes the semaphore unlink operation. -1 Indicates an error. The function sets errno to one of the following values: o EACCESS - Permission is denied to unlink the named semaphore. o ENAMETOOLONG - The length of the path name exceeds PSEM_MAX_PATHNAME defined in semaphore.h. o ENOENT - The named semaphore does not exist. o EVMSERR - OpenVMS specific nontranslatable error code.