DEVELOPMENT EDITION · 769442725406
Library Reference
On this page

Ada.Synchronous_Task_Control

Suspension objects (Ada RM D.10): a task waits in Suspend_Until_True until another sets the object true.

Read the family guide for representation, selection and resource rules. The complete declaration page retains exact signatures/contracts; the source specification is the implementation baseline.

Availability and ownership

A library-level suspension object is synchronised state, shared by tasks without a data race. At most one task waits on each (B3029), and Suspend_Until_True may wait, so a protected action does not call it (B3020). The object's state is kept by the run-time, by its lock, so passing the object by copy changes nothing.

Import and instantiate

with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control;
...
Go : Suspension_Object;

API 001

Suspension_Object (declaration) — A suspension object; false when declared.

Declared interface:

type Suspension_Object is limited private;

API 002

Set_True (declaration) — Makes it true, waking the task waiting on it.

Declared interface:

procedure Set_True (S : in out Suspension_Object)
  with Global => null;

API 003

Set_False (declaration) — Makes it false.

Declared interface:

procedure Set_False (S : in out Suspension_Object)
  with Global => null;

API 004

Current_State (declaration) — Its state now (another task may change it at once).

Declared interface:

function Current_State (S : Suspension_Object) return Boolean
  with Volatile_Function, Global => null;

API 005

Suspend_Until_True (declaration) — Waits until it is true, then makes it false.

Declared interface:

procedure Suspend_Until_True (S : in out Suspension_Object)
  with Global => null;