Annotated Ada Reference ManualLegal Information
Table of Contents   Index   References   Search   Previous   Next 

 D.10 Synchronous Task Control

1
[This clause describes a language-defined private semaphore (suspension object), which can be used for two-stage suspend operations and as a simple building block for implementing higher-level queues.] 

Static Semantics

2
The following language-defined package exists: 
3/2
{AI95-00362-01} package Ada.Synchronous_Task_Control is
  pragma Preelaborate(Synchronous_Task_Control);
4
  type Suspension_Object is limited private;
  procedure Set_True(S : in out Suspension_Object);
  procedure Set_False(S : in out Suspension_Object);
  function Current_State(S : Suspension_Object) return Boolean;
  procedure Suspend_Until_True(S : in out Suspension_Object);
private
     ... -- not specified by the language
end Ada.Synchronous_Task_Control;
5
The type Suspension_Object is a by-reference type.
5.a/2
Implementation Note: {AI95-00318-02} The implementation can ensure this by, for example, making the full view an explicitly a limited record type.

Dynamic Semantics

6/2
{AI95-00114-01} An object of the type Suspension_Object has two visible states: True true and False false. Upon initialization, its value is set to False false.
6.a
Discussion: This object is assumed to be private to the declaring task, i.e. only that task will call Suspend_Until_True on this object, and the count of callers is at most one. Other tasks can, of course, change and query the state of this object. 
7/2
{AI95-00114-01} The operations Set_True and Set_False are atomic with respect to each other and with respect to Suspend_Until_True; they set the state to True true and False false respectively.
8
Current_State returns the current state of the object.
8.a
Discussion: This state can change immediately after the operation returns. 
9/2
{AI95-00114-01} The procedure Suspend_Until_True blocks the calling task until the state of the object S is True true; at that point the task becomes ready and the state of the object becomes False false.
10
{potentially blocking operation (Suspend_Until_True) [partial]} {blocking, potentially (Suspend_Until_True) [partial]} {Program_Error (raised by failure of run-time check)} Program_Error is raised upon calling Suspend_Until_True if another task is already waiting on that suspension object. Suspend_Until_True is a potentially blocking operation (see 9.5.1). 

Implementation Requirements

11
The implementation is required to allow the calling of Set_False and Set_True during any protected action, even one that has its ceiling priority in the Interrupt_Priority range.

Extensions to Ada 95

11.a/2
{AI95-00362-01} {extensions to Ada 95} Synchronous_Task_Control is now Preelaborated, so it can be used in preelaborated units.

Table of Contents   Index   References   Search   Previous   Next 
Ada-Europe Sponsored by Ada-Europe