RTEMS Logo

RTEMS 4.9.3 On-Line Library


Semaphore Manager twai_sem - Wait on Semaphore with Timeout

PREV UP NEXT Bookshelf RTEMS ITRON 3.0 API User's Guide

3.4.6: twai_sem - Wait on Semaphore with Timeout

CALLING SEQUENCE:

ER twai_sem(
  ID semid,
  TMO tmout
);

STATUS CODES:

E_OK - Normal Completion

E_ID - Invalid ID number (semid was invalid or could not be used)

E_NOEXS - Object does not exist (the semaphore specified by semid does not exist)

E_OACV - Object access violation (A semid less than -4 was specified from a user task. This is implementation dependent.)

E_PAR - Parameter error (tmout is -2 or less)

E_DLT - The object being waited for was deleted (the specified semaphore was deleted while waiting)

E_RLWAI - Wait state was forcibly released (rel_wai was received while waiting)

E_TMOUT - Polling failure or timeout exceeded

E_CTX - Context error (issued from task-independent portions or a task in dispatch disabled state)

EN_OBJNO - An object number which could not be accessed on the target node is specified.

EN_PAR - A value outside the range supported by the target node and/or transmission packet format was specified as a parameter (a value outside supported range was specified for tmout)

DESCRIPTION:

This routine attempts to acquire the semaphore specified by semid. If the semaphore is available (i.e. positive semaphore count), then the semaphore count is decremented and the calling task returns immediately. Otherwise the calling tasking is blocked until the semaphore is released by a subsequent invocation of sig_sem or the timeout period specified by tmout milliseconds is exceeded. If the timeout period is exceeded, then the E_TMOUT error is returned.

By specifiying tmout as TMO_FEVR, this routine has the same behavior as wai_sem. Similarly, by specifiying tmout as TMO_POL, this routine has the same behavior as preq_sem.

NOTES:

Multiprocessing is not supported. Thus none of the "EN_" status codes will be returned.

This routine may cause the calling task to block.

A clock tick is required to support the timeout functionality of this routine.


PREV UP NEXT Bookshelf RTEMS ITRON 3.0 API User's Guide

Copyright © 1988-2008 OAR Corporation