[ Home | Alpha index | Topic index | Tutorials | Download | Feedback ]

The OS/2 API Project

DosCloseMutexSem

[ Syntax | Params | Returns | Include | Usage | Structs | Gotchas | Code | Also ]

Syntax

rc = DosCloseMutexSem( phmtxSemaphore );

Parameters

PHMTX phmtxSemaphore (input)
This is a pointer to the HMTX that contains the handle to the semaphore to be closed.

Returns

APIRET rc
The following values can be returned
0NO_ERRORSemaphore closed successfully
6ERROR_INVALID_HANDLEError, The value in phmtxSemaphore does not point to a valid semaphore
301ERROR_SEM_BUSYError, Another thread in this process is blocked on the semaphore

Include Info

#define INCL_DOSSEMAPHORES
#include <os2.h>

Usage Explanation

DosCloseMutexSem decrements, by one (1), the usage count for the semaphore pointed to by phmtxSemaphore. If the usage count goes to zero (0) then the semaphore is freed from the system.

Relevant Structures

Gotchas

Sample Code

#define INCL_DOSSEMAPHORES #include <os2.h> PHMTX phmtxMySemaphore; /* pointer to my semaphore handle */ /* a mutex semaphore is successfully created */ /* its handle is placed in phmtxMySemaphore */ rc = DosCloseMutexSem(phmtxMySemaphore); if (rc != 0) { /* We got an error to take care of. */ } else { /* The semaphore was successfully closed */ }

See Also

DosCreateMutexSem, DosOpenMutexSem, DosQueryMutexSem, DosReleaseMutexSem, DosRequestMutexSem

Author

Joe Phillips - jaiger@eng2.uconn.edu

Additions

Last modified May 27/1996
Please send all errors, comments, and suggestions to: timur@vnet.ibm.com

The OS/2 API Project

DosCloseMutexSem