procedure Barrier_Wait ( ID : in RTEMS.ID; Timeout : in RTEMS.Interval; Result : out RTEMS.Status_Codes );
RTEMS.SUCCESSFUL
- barrier obtained successfully
RTEMS.UNSATISFIED
- barrier not available
RTEMS.TIMEOUT
- timed out waiting for barrier
RTEMS.OBJECT_WAS_DELETED
- barrier deleted while waiting
RTEMS.INVALID_ID
- invalid barrier id
This directive acquires the barrier specified by
id. The RTEMS.WAIT
and RTEMS.NO_WAIT
components of the options parameter indicate whether the calling task
wants to wait for the barrier to become available or return immediately
if the barrier is not currently available. With either
RTEMS.WAIT
or RTEMS.NO_WAIT
,
if the current barrier count is positive, then it is
decremented by one and the barrier is successfully acquired by
returning immediately with a successful return code.
Conceptually, the calling task should always be thought of as blocking when it makes this call and being unblocked when the barrier is released. If the barrier is configured for manual release, this rule of thumb will always be valid. If the barrier is configured for automatic release, all callers will block except for the one which is the Nth task which trips the automatic release condition.
The timeout parameter specifies the maximum interval the calling task is
willing to be blocked waiting for the barrier. If it is set to
RTEMS.NO_TIMEOUT
, then the calling task will wait forever.
If the barrier is available or the RTEMS.NO_WAIT
option
component is set, then timeout is ignored.
The following barrier acquisition option constants are defined by RTEMS:
RTEMS.WAIT
- task will wait for barrier (default)
RTEMS.NO_WAIT
- task should not wait
A clock tick is required to support the timeout functionality of this directive.
Copyright © 1988-2007OAR Corporation