30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.5. EXTENDED SYNCHRONIZATION AND COMMUNICATION FUNCTIONS 115<br />

tk ref mtx<br />

Refer Mutex Status<br />

[C Language Interface]<br />

ER ercd = tk_ref_mtx ( ID mtxid, T_RMTX *pk_rmtx ) ;<br />

[Parameters]<br />

ID mtxid Mutex ID<br />

T RMTX* pk rmtx Address of packet for returning status information<br />

[Return Parameters]<br />

ER ercd Error code<br />

pk rmtx detail:<br />

VP exinf Extended information<br />

ID htsk ID of task locking the mutex<br />

ID wtsk ID of tasks waiting to lock the mutex<br />

(Other implementation-dependent parameters may be added beyond this point.)<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E PAR<br />

Normal completion<br />

Invalid ID number (mtxid is invalid or cannot be used)<br />

Object does not exist (the mutex designated in mtxid does not exist)<br />

Parameter error (the return parameter packet address cannot be used)<br />

[Description]<br />

References the status of the mutex designated in mtxid, passing in the return parameters the task<br />

currently locking the mutex (htsk), tasks waiting to lock the mutex (wtsk), and extended information<br />

(exinf).<br />

htsk returns the ID of the task locking the mutex. If no task is locking it, htsk = 0 is returned.<br />

wtsk indicates the ID of a task waiting to lock the mutex. If there are multiple waiting tasks, the ID of<br />

the task at the head of the queue is returned. If no tasks are waiting, wtsk = 0 is returned.<br />

If the designated mutex does not exist, error code E NOEXS is returned.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!