comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Catching Ctrl-C SIGINT
Date: 17 Jan 2005 21:37:16 +0000
Date: 2005-01-17T21:37:16+00:00	[thread overview]
Message-ID: <x7vwtubbuur.fsf@smaug.pushface.org> (raw)
In-Reply-To: csgasv$2u3$1@fsuj29.rz.uni-jena.de

Christopher Broeg <broeg@astro.uni-jena.de~> writes:

>     protected body Catch_Interrupt is
>        procedure Clean_up is
>        begin
>           Put_line("Interrupt SIGINT caught. sending signal ");
>           Signal_public;
>           Put_line("SIGNAL SENT. ");
>        end Clean_Up;
>     end Catch_Interrupt;

I suspect that an interrupt handler isn't allowed to call an entry of
a PO?

(gdb) b exception
Breakpoint 1 at 0x8059012: file a-except.adb, line 1306.
(gdb) handle SIGINT pass
SIGINT is used by the debugger.
Are you sure you want to change it? (y or n) y

Signal        Stop      Print   Pass to program Description
SIGINT        Yes       Yes     Yes             Interrupt
(gdb) run
Starting program: /home/simon/tmp/broeg/test1 
[New Thread 1024 (LWP 4260)]
[New Thread 2049 (LWP 4261)]
[New Thread 1026 (LWP 4262)]
[New Thread 2051 (LWP 4263)]
[New Thread 3076 (LWP 4264)]
 1 2 3
Program received signal SIGINT, Interrupt.
[Switching to Thread 2051 (LWP 4263)]
0x400656b2 in sigsuspend () from /lib/libc.so.6
Current language:  auto; currently c
(gdb) c
Continuing.
 4Interrupt SIGINT caught. sending signal 

Breakpoint 1, PROGRAM_ERROR at 0x0804ab66 in <catch_interrupt__eventPT__signalP> (<_object>=@0x806f38c) at catch_interrupt.adb:27
27             procedure  Signal is
Current language:  auto; currently ada
(gdb) bt
#0  <__gnat_raise_nodefer_with_msg> (e=0x806b494) at a-except.adb:1306
#1  0x0805934b in ada.exceptions.raise_with_msg (e=0x806b494, setup=1)
    at a-except.adb:1480
#2  0x080591bb in <__gnat_raise_exception> (e=0x806b494, message=0x806871c)
    at a-except.adb:1348
#3  0x08055b2e in system__tasking__protected_objects__entries__lock_entries ()
#4  0x0804ab66 in <catch_interrupt__eventPT__signalP> (<_object>=@0x806f38c)
    at catch_interrupt.adb:27
#5  0x0804a7e1 in catch_interrupt.signal_public () at catch_interrupt.adb:9



   protected type Handling is
      entry Wait;
      procedure Trigger;
      pragma Interrupt_Handler (Trigger);
   private
      Ready : Boolean := False;
   end Handling;

   protected body Handling is

      entry Wait when Ready is
      begin
         Ready := False;
      end Wait;

      procedure Trigger is
      begin
         Ready := True;
      end Trigger;

   end Handling;


-- 
Simon Wright                               100% Ada, no bugs.



  parent reply	other threads:[~2005-01-17 21:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-17 12:26 Catching Ctrl-C SIGINT Christopher Broeg
2005-01-17 14:19 ` Martin Dowie
2005-01-17 14:35   ` Christopher Broeg
2005-01-17 21:37 ` Simon Wright [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-01-17 14:07 Christopher Broeg
2005-01-17 14:13 Christopher Broeg
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox