From: Lutz Donnerhacke <lutz@iks-jena.de>
Subject: Signal handler blocks proteced type
Date: Thu, 25 Mar 2004 17:03:19 +0000 (UTC)
Date: 2004-03-25T17:03:19+00:00 [thread overview]
Message-ID: <slrnc6646n.nt.lutz@taranis.iks-jena.de> (raw)
The following test program shows a strange behavior:
A protected type with a signal handler is instantiated in order to catch a
signal. If the signal is not catched, everything works fine. If the signal
was delivered, the inner scope will not be terminated, because the protected
type can not be finalized.
Why?
\f
with Ada.Text_IO; use Ada.Text_IO;
with Ints;
procedure t is
begin
Put_Line("Enviroment started.");
declare
i : Ints.Int;
begin
Put_Line("Waiting.");
delay 2.0;
if i.Found then
Put_Line("Catched.");
else
Put_Line("Nothing.");
end if;
end;
Put_Line("Enviroment stopped.");
end t;
\f
Example:
$ ./t
Enviroment started.
Waiting.
Nothing.
Enviroment stopped.
$ ./t & sleep 1; kill -1 %1; sleep 3
[1] 2366
Enviroment started.
Waiting.
Catched.
$ jobs
[1]+ Running ./t &
\f
with Ada.Interrupts.Names; use Ada.Interrupts.Names;
package Ints is
protected type Int is
procedure Signal;
pragma Attach_Handler(Signal, SIGHUP);
procedure Reset;
function Found return Boolean;
private
catched : Boolean := False;
end Int;
end Ints;
\f
package body Ints is
protected body Int is
procedure Signal is
begin
catched := True;
end Signal;
procedure Reset is
begin
catched := False;
end Reset;
function Found return Boolean is
begin
return catched;
end Found;
end Int;
end Ints;
next reply other threads:[~2004-03-25 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-25 17:03 Lutz Donnerhacke [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-03-25 17:05 Signal handler blocks proteced type Lutz Donnerhacke
2004-03-26 10:00 ` Lutz Donnerhacke
2004-03-26 17:12 ` Florian Weimer
2004-03-27 17:45 ` Simon Wright
2004-03-27 23:38 ` Florian Weimer
2004-03-28 10:27 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox