ploc_mtx

Outline

Lock mutex (polling).

C format

 ER      ploc_mtx (ID mtxid);
Parameter(s)

I/O

Parameter

Description

I

 ID      mtxid;
ID number of the mutex.



Explanation

This service call locks the mutex specified by parameter mtxid.

If the target mutex could not be locked (another task has been locked) when this service call is issued but "E_TMOUT" is returned.

When the mutex is locked, this service call changes the current priority of the invoking task to the ceiling priority of the target mutex. However, this service call does not change the current priority when the invoking task has locked other mutexes and the ceiling priority of the target mutex is lower than or equal to the ceiling priority of the locked mutexes.

Note This service call returns "E_ILUSE" if this service call is re-issued for the mutex that has been locked by the invoking task (multiple-locking of mutex).

Return value

Macro

Value

Description

E_OK

0

Normal completion.

E_ID

-18

Invalid ID number.

- mtxid < 0

- mtxid > VTMAX_MTX

E_CTX

-25

Context error.

- This service call was issued from a non-task.

- This service call was issued in the dispatching disabled state.

- This service call was issued in the status "PSW.IPL > kernel interrupt mask level".

E_ILUSE

-28

Illegal use of service call.

- The invoking task has already locked the target mutex.

- Ceiling priority violation (the base priority of the invoking task < the ceiling priority of the target mutex)

E_TMOUT

-50

Polling failure.