Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
DosCloseSem (1.2)
◄Function Group► ◄Overview► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
#define INCL_DOSSEMAPHORES
USHORT DosCloseSem(hsem)
HSEM hsem; /* semaphore handle */
The DosCloseSem function closes a specified system semaphore. If another
process has the semaphore open, it remains open and can be used by that
process, although the semaphore cannot be used by the process that closes
it. This function deletes the semaphore only when the last process using the
semaphore closes it.
Parameter Description
────────────────────────────────────────────────────────────────────────────
hsem Identifies the semaphore to be closed. This handle must have been
previously created or opened by using the DosCreateSem or
DosOpenSem function.
Return Value
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be the following:
ERROR_SEM_IS_SET
Comments
If a process does not close its semaphores before terminating, the system
closes them.
Example
This example opens a previously created system semaphore, then calls the
DosCloseSem function to close it:
HSEM hsem; /* semaphore handle */
DosOpenSem(&hsem, "\\sem\\abc"); /* opens the semaphore */
.
.
.
DosCloseSem(hsem); /* closes the semaphore */
See Also
DosCreateSem, DosOpenSem
♦