comp.lang.ada
 help / color / mirror / Atom feed
From: "Ada @ BRL" <ada.brl.2011@gmail.com>
Subject: Interrupts handling in ADA
Date: Sat, 10 Dec 2011 12:43:58 -0800 (PST)
Date: 2011-12-10T12:43:58-08:00	[thread overview]
Message-ID: <30143086.6.1323549838421.JavaMail.geo-discussion-forums@vbbfq24> (raw)

Hello,
I'm an Erasmus student at the University of Bristol - UK and I'm carrying out the work for my master thesis in Computer Engineering.

I'm programming a multithreading application in C / C++ and ADA.
The latter is a completely new language for me...

The environment of ADA applcation is:
I have 4 tasks that execute at the same time:
one is the main task,
the other three execute a "read" from network (socket) function inside their bodies (on the other side there's the C/C++ application with 3 network sockets).
[I decided to use the sockets instead of dll/lib import because this approach hasn't worked... =( ]

I want that when new data is available on one or more socket threads, this / these threads somehow notify the main thread that data is arrived and then safely send the data to it.

I've thought to use the interrupts...because I haven't found any references about the use of "events" in ADA.
I've thought to attach three different handler of interrupts into the main task and then to generate the interrupt from the socket task with ada.interrupts.signal.generate_interrupt.
Socket 1 will generate interrupt #1, socket 2 -> interrupt #2 and so on.

May you tell me please if this is the right way to face the problem?
I'm not skilled in ada and so there could be other better methods...

I've used the pragmas attach_handler and interrupt_handler but unfortunately I'm still not able to get all the stuff working...

I think it's a problem of ADA implementation because:
even if I call pragma unreserve_all_interrupts I've found that the function Is_Reserved(Interr_ID) returns FALSE only for this signals IDs: 2(SIGINT), 4(SIGILL), 8(SIGFPE), 11(SISEGV), 15(SIGTERM), 22(SIGABRT).

I guess that this is the opposite behaviour as I expected...
If I try to set an handler to the interrupt say 9, the program cannot start due to this error:

raised PROGRAM_ERROR : adjust/finalize raised PROGRAM_ERROR: s-interr.adb:343 explicit raise

If I call the function Is_Attached the program suddenly exits:
Program exited with code 01.
(gdb) 

Do you know if is it possible to generate user defined interrupts?

Can you help me please to find out what's the problem?
Unfortunately there's not so much documentation about ADA  =( and I'm late for my thesis...

Thank you very much in advance for your help,
Ada @ BRL



             reply	other threads:[~2011-12-10 20:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 20:43 Ada @ BRL [this message]
2011-12-10 21:13 ` Interrupts handling in ADA Vinzent Hoefler
2011-12-10 22:09 ` Niklas Holsti
2011-12-10 22:27 ` Simon Wright
2011-12-11 20:21   ` Martin Dowie
2011-12-13 13:51     ` Ada BRL
2011-12-13 23:18       ` Martin Dowie
2011-12-13 14:11     ` Niklas Holsti
2011-12-13 14:54       ` Simon Wright
2011-12-13 15:06         ` Ada BRL
2011-12-13 21:49           ` Niklas Holsti
2011-12-13 23:18       ` Martin Dowie
2011-12-13 12:47   ` Ada BRL
2011-12-13 15:07     ` Simon Wright
2011-12-13 15:23       ` Ada BRL
2011-12-13 18:14         ` Simon Wright
2011-12-13 18:56           ` Ada BRL
2011-12-13 19:56           ` Bill Findlay
2011-12-13 22:15         ` Niklas Holsti
2011-12-13 15:34       ` Simon Wright
2011-12-13 17:55         ` Ada BRL
2011-12-13 18:18           ` Dmitry A. Kazakov
2011-12-13 19:01             ` Ada BRL
2011-12-13 19:58               ` Dmitry A. Kazakov
2011-12-13 18:24           ` Simon Wright
2011-12-11  0:15 ` Jeffrey Carter
2011-12-13 12:53   ` Ada BRL
2011-12-11  9:23 ` Dmitry A. Kazakov
2011-12-13 13:11   ` Ada BRL
2011-12-13 14:04     ` Dmitry A. Kazakov
2011-12-13 14:51       ` Ada BRL
2011-12-13 15:02         ` Ada BRL
2011-12-13 15:39         ` Dmitry A. Kazakov
2011-12-13 18:51           ` Ada BRL
2011-12-13 19:51             ` Dmitry A. Kazakov
2011-12-13 23:32             ` georg bauhaus
2011-12-11 12:04 ` Georg Bauhaus
2011-12-13 14:08   ` Ada BRL
2011-12-12  3:19 ` anon
2011-12-12  9:12   ` Niklas Holsti
2011-12-13 13:36     ` Ada BRL
2011-12-12 15:23   ` björn lundin
2011-12-13 13:38     ` Ada BRL
2011-12-13 13:56       ` Ludovic Brenta
2011-12-13 14:10         ` Ada BRL
2011-12-13 13:31   ` Ada BRL
replies disabled

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