From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,43da1b63a7c8cf39,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-25 09:03:20 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Signal handler blocks proteced type Date: Thu, 25 Mar 2004 17:03:19 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1080234199 28160 217.17.192.37 (25 Mar 2004 17:03:19 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Thu, 25 Mar 2004 17:03:19 +0000 (UTC) User-Agent: slrn/0.9.8.0 (Linux) Xref: archiver1.google.com comp.lang.ada:6514 Date: 2004-03-25T17:03:19+00:00 List-Id: 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? 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; 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 & 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; 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;