File : atomic_controller.ads
-- -*- Mode: Ada -*-
-- Filename : atomic_controller.ads
-- Description : this genetic monitor synchronizes the parallel part of
-- an atomic action and distributes a failure signal to
-- all (monitor is used in conjunction with
-- generic_atomic_actions)
-- Modifications : seperated the entry queues for the two possible check_out
-- conditions.
-- Author : Uwe Zimmer
-- Created On : Wed Aug 28 17:12:06 2002
-- Last Modified By: Uwe Zimmer
-- Last Modified On: Tue Aug 21 17:21:00 2007
-- Update Count : 0
-- Status : Unknown, Use with caution!
generic
type Task_Ids is (<>);
package Atomic_Controller is
type Atomic_State is (Checking_In,
All_Checked_In,
Checking_Out,
Final);
type Atomic_Condition is (Succeeded,
Late_Activation,
Time_Out,
Other_Exception);
type Check_Out_State is (Normal_Check_Out, Failed_Check_Out);
type Task_State is (Is_In, Is_Stopped, Is_Out);
type Task_List is array (Task_Ids) of Task_State;
Check_List_All_In : constant Task_List := (others => Is_In);
Check_List_All_Stopped : constant Task_List := (others => Is_Stopped);
Check_List_All_Out : constant Task_List := (others => Is_Out);
protected Monitor is
procedure Get_Id (Id : out Task_Ids);
entry Check_In (Task_Id : in Task_Ids);
entry Fail (Condition : in Atomic_Condition);
entry Failed;
entry Check_Out (Check_Out_State)
(Task_Id : in Task_Ids);
entry Action_Result (Condition : out Atomic_Condition);
private
Check_List : Task_List := Check_List_All_Out;
State : Atomic_State := Checking_In;
Final_Condition : Atomic_Condition := Succeeded;
Id_Counter : Task_Ids := Task_Ids'First;
end Monitor;
Repeated_Check_In : exception;
end Atomic_Controller;