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 109<br />

tk cre mtx<br />

Create Mutex<br />

[C Language Interface]<br />

ID mtxid = tk_cre_mtx ( T_CMTX *pk_cmtx ) ;<br />

[Parameters]<br />

T CMTX* pk cmtx Information about the mutex to be created<br />

pk cmtx detail:<br />

VP exinf Extended information<br />

ATR mtxatr Mutex attributes<br />

PRI ceilpri Mutex ceiling priority<br />

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

[Return Parameters]<br />

ID mtxid Mutex ID<br />

or Error Code<br />

[Error Codes]<br />

E OK<br />

E NOMEM<br />

E LIMIT<br />

E RSATR<br />

E PAR<br />

Normal completion<br />

Insufficient memory (memory for control block cannot be allocated)<br />

Number of mutexes exceeds the system limit<br />

Reserved attribute (mtxatr is invalid or cannot be used)<br />

Parameter error (pk cmtx or ceilpri is invalid)<br />

[Description]<br />

Creates a mutex, assigning to it a mutex ID.<br />

exinf can be used freely by the user to set miscellaneous information about the created mutex. The<br />

information set in this parameter can be referenced by tk ref mtx. If a larger area is needed for<br />

indicating user information, or if the information may need to be changed after the mutex is created,<br />

this can be done by allocating separate memory for this purpose and putting the memory packet address<br />

in exinf. The OS pays no attention to the contents of exinf.<br />

mtxatr indicates system attributes in its low bits and implementation-dependent information in the<br />

high bits. Designation in the system attributes part of mtxatr is as follows.<br />

mtxatr:= (TA_TFIFO || TA_TPRI || TA_INHERIT || TA_CEILING)| [TA_NODISWAI]<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!