D.10 Synchronous Task Control

From OC Systems Wiki!
< Guide:95lrm
Revision as of 23:07, 1 May 2019 by imported>WikiVisor
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

The following language-defined package exists:

package Ada.Synchronous_Task_Control is

   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);
    ... -- not specified by the language
end Ada.Synchronous_Task_Control;

The type Suspension_Object is a by-reference type.

Dynamic Semantics

An object of the type Suspension_Object has two visible states: true and false. Upon initialization, its value is set to false.

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 and false respectively.

Current_State returns the current state of the object.

The procedure Suspend_Until_True blocks the calling task until the state of the object S is true; at that point the task becomes ready and the state of the object becomes false.

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

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.

Copyright © 1992,1993,1994,1995 Intermetrics, Inc.
Copyright © 2000 The MITRE Corporation, Inc. Ada Reference Manual