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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,115d7688c91613a5,start X-Google-Attributes: gid103376,public From: Joerg Kienzle Subject: Interrupt problem in GNAT Date: 1999/05/19 Message-ID: <3742DC0D.B8F07A52@epfl.ch>#1/1 X-Deja-AN: 479660007 Content-Transfer-Encoding: 8bit X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Trace: 19 May 1999 17:43:09 +0100, lglsun3.epfl.ch Organization: EPFL MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-19T00:00:00+00:00 List-Id: Hi, I am running gnat 3.11w on Solaris, and I am trying to use interrupts to perform a periodic operation. I have declared the following package: with Ada.Interrupts; use Ada.Interrupts; with Ada.Interrupts.Names; use Ada.Interrupts.Names; package Clocks is protected Clock is procedure Tick; pragma Interrupt_Handler (Tick); pragma Attach_Handler (Tick, SIGALRM); end Clock; end Clocks; And the body: package body Clocks is protected body Clock is procedure Tick is begin -- Do something here end Tick; end Clock; end Clocks; As you can see in the spec, I am trying to attach the Tick procedure to the SIGALRM signal. In my main procedure, I use the operating system functions timer_create and timer_settime to tell the OS to send SIGALRM to my process every x seconds. This works; the process gets a SIGALRM signal, but my handler function in not called! Instead, "Alarm clock" is printed on the terminal and the process exits... The same thing happens if I use the "alarm" function to send the SIGALRM signal: with Interfaces.C; with Clocks; procedure Main is procedure Alarm (Sec : C.Unsigned); pragma Import (C, Alarm, "alarm"); procedure Set_Alarm (I : in Natural); procedure Set_Alarm (I : in Natural) is begin Alarm (C.Unsigned (I)); end Set_Alarm; begin Set_Alarm (5); while True loop null; end loop; end Main; I tried other signals, but I still doesn't work. What am I doing wrong? - J�rg -- --------------------------------------------------------------------------- - Joerg Kienzle - Swiss Federal Institue of Technology - CH-1015 Lausanne - - email : Joerg.Kienzle@epfl.ch WWW : http://lglwww.epfl.ch/~jkienzle/ - - phone : ++41 21 693 42 37 fax : ++41 21 693 50 79 -