rtems_status_code rtems_barrier_wait( rtems_id id, rtems_interval timeout );
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-2008 OAR Corporation