--  Verada predefined library: Ada.Synchronous_Task_Control (Ada RM D.10), suspension objects:
--  a task waits in Suspend_Until_True until another sets the object true. An object of
--  the type is synchronised state, shared by tasks without a race (B3019 does not apply), and,
--  as Ravenscar and Jorvik require, at most one task ever waits on it, which Verada checks
--  (B3029 otherwise). Suspend_Until_True may wait, so a protected action does not call it.
private with Verada.Tasking;
package Ada.Synchronous_Task_Control is
   type Suspension_Object is limited private;

   --  wakes the task waiting on S, if any; else the next Suspend_Until_True returns at once
   procedure Set_True (S : in out Suspension_Object)
     with Global => null;

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

   --  S's state now (another task may change it at once)
   function Current_State (S : Suspension_Object) return Boolean
     with Volatile_Function, Global => null;

   --  waits until S is true, then makes it false
   procedure Suspend_Until_True (S : in out Suspension_Object)
     with Global => null;
private
   --  (its state is the run-time's, by its lock: the record may be passed by copy)
   type Suspension_Object is limited record
      Lock : Verada.Tasking.Lock_Id := Verada.Tasking.New_Lock;
   end record;
end Ada.Synchronous_Task_Control;
