The SEM_DELETE procedure destroys the reference to the specified semaphore within the current IDL process. (Semaphores themselves are independent of any IDL process.)
SEM_DELETE behaves differently on UNIX and Windows systems:
On UNIX systems, a semaphore can exist even if no process has a reference to it. In addition to destroying the reference to the specified semaphore within the current IDL process, SEM_DELETE will schedule the semaphore itself for destruction in the following situations:
- If the semaphore itself was created by the current IDL process, and the DESTROY_SEMAPHORE keyword was not explicitly set equal to zero.
- If the reference to the semaphore was created in the current IDL process with the DESTROY_SEMAPHORE keyword set equal to one.
See DESTROY_SEMAPHORE for additional information.
A semaphore that has been scheduled for destruction will be destroyed when the last process that has a reference to it destroys its reference.
Note: On UNIX systems, a semaphore is marked for deletion when the process that created the semaphore exits. While this does not immediately delete the semaphore itself, it does free up the semaphore’s name. This means that after the process that created a semaphore exits — even if other processes have references to that semaphore — SEM_CREATE will create a new and distinct semaphore with the same name. Any subsequent processes that call SEM_CREATE with that name will receive a reference to the new semaphore.
If this behavior causes problems for your application, ensure that the process that creates a semaphore does not exit until all processes that use the semaphore have either exited or deleted their references to the semaphore.
On Windows systems, a semaphore only exists as long as some process has a reference to it. SEM_DELETE destroys the reference to the specified semaphore.
See SEM_LOCK for an example using this function.
A scalar string containing the name associated with the semaphore. This is the name used when creating the semaphore with SEM_CREATE.
Note: Semaphore names must be 24 characters or less on Mac platforms.
SEM_CREATE, SEM_LOCK, SEM_RELEASE