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

The OS/2 API Project


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


rc = DosReleaseMutexSem( hmtxSemaphore );


HMTX hmtxSemaphore (input)
The handle of the semaphore to be released.


The following values can be returned
0NO_ERRORSemaphore released successfully
6ERROR_INVALID_HANDLEError, The value in phmtxSemaphore does not point to a valid semaphore, The calling process must first have access to the semaphore in question
288ERROR_NOT_OWNERError, The calling process does not currently own the semaphore

Include Info

#include <os2.h>

Usage Explanation

DosReleaseMutexSem releases ownership of mutex semaphore. It decrements, by one (1), the usage count of the mutex semaphore refered to by hmtxSemaphore. If the usage count for the mutex semaphore goes to zero (0), ownership of the semaphore will be passed on to another thread that has been blocked for requesting it.

Relevant Structures


The process calling DosReleaseMutexSem must first obtain access to the semaphore in question or ERROR_INVALID_HANDLE will be returned.

Sample Code

#define INCL_DOSSEMAPHORES #include <os2.h> HMTX hmtxMySemaphore; /* MySemaphore handle */ /* access is gained to the semaphore in question */ /* either by DosCreateMutexSem ... */ /* ... or by DosOpenMutexSem */ /* its handle is placed in hmtxMySemaphore */ /* process becomes owner of semaphore */ /* by way of successful call to DosRequestMutexSem */ rc = DosReleaseMutexSem(hmtxMySemaphore); if (rc != 0) { /* We got an error to take care of. */ }

See Also

DosCloseMutexSem, DosCreateMutexSem, DosOpenMutexSem, DosQueryMutexSem, DosRequestMutexSem


Joe Phillips - jaiger@eng2.uconn.edu


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

The OS/2 API Project