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.7 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bdf72b2364b0da13,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.2 with SMTP id gm2mr5319771pbc.4.1323549838896; Sat, 10 Dec 2011 12:43:58 -0800 (PST) Path: lh20ni7723pbb.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: "Ada @ BRL" Newsgroups: comp.lang.ada Subject: Interrupts handling in ADA Date: Sat, 10 Dec 2011 12:43:58 -0800 (PST) Organization: http://groups.google.com Message-ID: <30143086.6.1323549838421.JavaMail.geo-discussion-forums@vbbfq24> Reply-To: comp.lang.ada@googlegroups.com NNTP-Posting-Host: 82.32.58.120 Mime-Version: 1.0 X-Trace: posting.google.com 1323549838 20638 127.0.0.1 (10 Dec 2011 20:43:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 10 Dec 2011 20:43:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.32.58.120; posting-account=yig7mwoAAAAAcduNbH7Dpal1sjCSAijA User-Agent: G2/1.0 X-Google-Web-Client: true Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-12-10T12:43:58-08:00 List-Id: 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