Mutex Object
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:
- the mutex owner releases the mutex
- the wait call times out
- the mutex is abandoned
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: