INtime SDK Help
ReleaseMutex, RtReleaseMutex (iwin32)
INtime SDK v7.1 > About INtime > Alternate APIs > iwin32 API > iwin32 API > ReleaseMutex, RtReleaseMutex (iwin32)

Releases ownership of the specified mutex object.

BOOLEAN ReleaseMutex(
    HANDLE hMutex

BOOLEAN RtReleaseMutex(
    HANDLE hMutex


Handle to the mutex object. RtCreateMutex returns this handle.


You cannot call this function from a pure INtime thread. RtReleaseMutex can also be used from a Windows application to release an iwin32 mutex.

If the calling thread does not own the mutex object, ReleaseMutex fails.

A thread gets ownership of a mutex by specifying a handle to the mutex in a wait function. The thread that creates a mutex object can also get immediate ownership without using a wait function. When the owning thread no longer needs to own the mutex object, it calls ReleaseMutex.

While a thread owns a mutex, it can specify the same mutex in additional wait-function calls without blocking its execution. This prevents a thread from deadlocking itself while waiting for a mutex it already owns. However, to release its ownership, the thread must call ReleaseMutex once for each time the mutex satisfied a wait function call.

When a thread fully releases the last mutex it owns, its priority is restored to what it was upon entering the first mutex (it may have changed when a better priority thread entered the wait queue for an owned mutex).

Return Values

0 (zero)
Failure. For extended error information, see GetLastError


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/iwin32.h


See Also

RtCreateMutex, iwin32 API, iwin32 Overview