RTEMS Logo

RTEMS 4.7.99.2 On-Line Library


Barrier Manager BARRIER_OBTAIN - Acquire a barrier

PREV UP NEXT Bookshelf RTEMS Ada User's Guide

20.4.4: BARRIER_OBTAIN - Acquire a barrier

CALLING SEQUENCE:

procedure Barrier_Obtain (
   ID         : in     RTEMS.ID;
   Option_Set : in     RTEMS.Option;
   Timeout    : in     RTEMS.Interval;
   Result     :    out RTEMS.Status_Codes
);

DIRECTIVE 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

DESCRIPTION:

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.

NOTES:

The following barrier acquisition option constants are defined by RTEMS:

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


PREV UP NEXT Bookshelf RTEMS Ada User's Guide

Copyright © 1988-2004 OAR Corporation