From: Philippe Laval <laval@obs-vlfr.fr>
Subject: Suspension_Object problem
Date: Wed, 15 Jan 2003 16:35:49 +0100
Date: 2003-01-15T16:35:49+01:00 [thread overview]
Message-ID: <3E257FD5.8765352C@obs-vlfr.fr> (raw)
The following program compiles without error in gnat 3.14p.
However the line "From H: P is now released" never shows up. What is
wrong?
-- File Susp_O.adb
with P_Pkg;
with H_Pkg;
procedure Susp_O is
begin
null;
end Susp_O;
----------------------------------------------------------------------------------------------
-- File P_Pkg.ads
with Ada.Synchronous_Task_Control; use Ada.Synchronous_Task_Control;
package P_Pkg is
protected type Protected_Lock is
procedure Set_Lock;
procedure Release;
private
Lock : Suspension_Object;
end Protected_Lock;
type Lock_Access is access Protected_Lock;
Attack_Lock : Lock_Access;
task P;
end P_Pkg;
------------------------------------------------------------------------------------------------
-- File P_Pkg.ads
package H_Pkg is
task H;
end H_Pkg;
------------------------------------------------------------------------------------------------
-- File P_Pkg.adb
with Ada.Text_IO; use Ada.Text_IO;
package body P_Pkg is
protected body Protected_Lock is
procedure Set_Lock is
begin
Suspend_Until_True (Lock);
end Set_Lock;
procedure Release is
begin
Set_True (Lock);
end Release;
end Protected_Lock;
task body P is
begin
Attack_Lock := new Protected_Lock;
Put_Line ("P is being suspended.");
Put_Line ("Waiting to be released by H...");
Attack_Lock.Set_Lock;
Put_Line ("P is now released.");
end P;
end P_Pkg;
------------------------------------------------------------------------------------------------
-- File H_Pkg.adb
with Ada.Text_IO; use Ada.Text_IO;
with P_Pkg;
package body H_Pkg is
task body H is
begin
delay 1.0;
P_Pkg.Attack_Lock.Release;
Put_Line ("From H : P is released now!");
end H;
end H_Pkg;
------------------------------------------------------------------------------------------------
Philippe Laval
Observatoire Oc�anologique
F-06234 Villefranche-sur-Mer CEDEX
laval@obs-vlfr.fr
next reply other threads:[~2003-01-15 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-15 15:35 Philippe Laval [this message]
2003-01-15 15:46 ` Suspension_Object problem Jean-Pierre Rosen
2003-01-15 19:02 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox