Mutex Object

The RTSS mutex object is a synchronization object whose state is signaled when it is not owned by any thread and not signaled when the mutex is owned by a thread. The mutex object arbitrates exclusive access to a shared resource.

NOTE: Internal objects are created from the system's internal allocation space (IntMSpace) when local memory is used.

Ownership

A thread owns a mutex between the exit from a wait function and the call to RtReleaseMutex. No other thread can own the mutex between these calls. If another thread calls a wait function while the mutex is owned (not signaled), the wait function will not exit until:

A mutex is considered abandoned when the owning thread terminates. The waiter can learn how a mutex was released by examining the wait function's return value. A thread that acquires an abandoned mutex should expect an inconsistent shared resource.

If more than one thread is waiting for ownership, the thread with the highest priority gets ownership. In cases where threads with the same priority are waiting to be owners, the earliest request goes first.

RTSS mutex objects are always maintained in the RTSS environment and namespace. However, Windows processes may create, open, and own RTSS mutex objects. The RTSS mutex name space is case-sensitive and separate from the Windows mutex name space. If a mutex object is unnamed, then it can only be used within the creating process.

Topics: