tk_unl_mtx
Unlock Mutex
ER ercd = tk_unl_mtx ( ID mtxid ) ;
ID mtxid Mutex ID
ER ercd Error code
E_OK Normal completion
E_ID Invalid ID number (mtxid is invalid or cannot be used)
E_NOEXS Object does not exist (the mutex specified in mtxid does not exist)
E_ILUSE Illegal use (not a mutex locked by the invoking task)
Unlocks the mutex specified in mtxid. If there are tasks waiting to lock the mutex, the WAIT state of
the task at the head of the queue for that mutex is released and that task locks the mutex.
If a mutex that was not locked by the invoking task is specified, error code E_ILUSE is returned.
If the unlocked mutex is a priority inheritance mutex or priority ceiling mutex, task priority must be lowered as follows. If as a result of this operation the invoking task no longer has any locked mutexes, the invoking task priority is lowered to its base priority. If the invoking task continues to have locked mutexes after this operation, the invoking task priority is lowered to whichever of the following priority levels is highest.
a. The highest priority of all remaining locked mutexes.
b. The base priority.
Note that the lowering of priority when locked mutexes remain is an implementation-dependent optional speci.cation.
If a task terminates (goes to DORMANT state or NON-EXISTENT state) without explicitly unlocking mutexes, all its locked mutexes are automatically unlocked.

Comments