RtkReleaseMutex

RtkReleaseMutex relinquishes ownership of an RTSS mutex.

Syntax

BOOL RtkReleaseMutex(
    RTSSINST RtssInst,
    PULONG pErrorCode,
    HANDLE hMutex
);

Parameters

RtssInst

An RTSSINST value returned from a call to RtkRtssAttach.

pErrorCode

A pointer to a location where additional error information may be returned. This location need not be defined; the user may pass a NULL value. If defined, this location is set to NULL if no error occurred.

hMutex

The handle which identifies the mutex object as returned by a preceding call to RtkCreateMutex or RtkOpenMutex.

Return Values

A non-zero value if the function succeeds, 0 (zero) if the function fails

Remarks

RtkReleaseMutex fails if the calling thread does not own the mutex object.

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

While a thread has ownership of 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 that it already owns. However, to release its ownership, the thread must call RtkReleaseMutex once for each time that the mutex satisfied a wait.

Requirements

Header Rtkapi.h
Library rtx_rtk.lib

See Also:

RtkCreateMutex

RtkOpenMutex

RtkWaitForSingleObject

IntervalZero.com | Support | Give Feedback