comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: problem with ada.interrupts
Date: 10 Aug 2005 14:00:40 -0400
Date: 2005-08-10T14:00:40-04:00	[thread overview]
Message-ID: <wcc64udzn7b.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1123689689.517640.262600@z14g2000cwz.googlegroups.com

evangeli@cnam.fr writes:

> hello
> in my program i want to catch the interruption by the user, e.g.,
> ctrl+c.
> i looked at the RM and it seems that package ada.interrupts is designed
> to do this kind of things.

Yes.  I have done this successfully, on both GNAT and Sofcheck's
AdaMagic compilers, on WindowsXP, Linux, and Solaris.

Technically, it is wrong to do I/O in a protected procedure, but some
compilers allow it.  You should instead have the handler procedure
trigger an entry barrier, and have some task wait for the entry.

You need a pragma on the SIGINT_Handler.  Pragma Attach_Handler is
simpler; Interrupt_Handler is more powerful.  See the RM for details.

On GNAT, you need pragma Unreserve_All_Interrupts on some systems.
See the GNAT docs.

> it seems that even this little program does not terminate :
> 
> with
>   Ada.Interrupts;
> 
> procedure Test is
> begin
>    null:
> end;
> 
> i suspect a problem in the elaboration of package Ada.Interrupts, but i
> have no idea of how to deal with it.
> any idea?

No.  You could try stepping through that code in gdb.

- Bob



  reply	other threads:[~2005-08-10 18:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-10 16:01 problem with ada.interrupts evangeli
2005-08-10 18:00 ` Robert A Duff [this message]
2005-08-10 18:19 ` jimmaureenrogers
2005-08-25 12:25 ` Thierry Pirot
replies disabled

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