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.4. SYNCHRONIZATION AND COMMUNICATION FUNCTIONS 85<br />

tk ref sem<br />

Reference Semaphore Status<br />

[C Language Interface]<br />

ER ercd = tk_ref_sem ( ID semid, T_RSEM *pk_rsem ) ;<br />

[Parameters]<br />

ID semid Semaphore ID<br />

T RSEM* pk rsem Address of packet for returning status information<br />

pk rsem detail:<br />

VP exinf Extended information<br />

ID wtsk Waiting task information<br />

INT semcnt Semaphore count<br />

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

[Return Parameters]<br />

ER ercd Error code<br />

[Error Codes]<br />

E OK<br />

E ID<br />

E NOEXS<br />

E PAR<br />

Normal completion<br />

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

Object does not exist (the semaphore designated in semid does not exist)<br />

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

[Description]<br />

References the status of the semaphore designated in semid, passing in the return parameters the<br />

current semaphore count (semcnt), information on tasks waiting for the semaphore (wtsk), and extended<br />

information (exinf).<br />

wtsk indicates the ID of a task waiting for the semaphore. If there are two or more such tasks, the ID<br />

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

If the designated semaphore 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!