Anonymous user
Singleton: Difference between revisions
→Thread Safe
Line 38:
===Thread Safe===
<ada>package Protected_Singleton is
procedure Set_Data (Value : Integer);
private
protected
procedure Set(Value : Integer);
function Get return Integer;
Line 49 ⟶ 47:
Data : Integer := 0;
end Instance_Type;
end Protected_Singleton;</ada>
Line 59 ⟶ 55:
--------------
procedure Set_Data (
begin
Instance.Set(Value);
end Set_Data;
Line 71 ⟶ 64:
--------------
function Get_Data
begin
return Instance.Get;
end Get_Data;
--------------
--
--------------
---------
Line 109 ⟶ 93:
end Get;
end
end Protected_Singleton;</ada>
|