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-7-bit X-Google-Thread: 103376,1096a7986b560ad6 X-Google-Attributes: gid103376,public From: nabbasi@earthlink.net Subject: Re: In Exception ? Date: 1998/04/09 Message-ID: <6gkafp$p31@drn.newsguy.com>#1/1 X-Deja-AN: 342661539 References: <35214b7a.0@news.profinet.at> <6g7fpc$l08$1@usenet.rational.com> <6gcjru$7im@drn.newsguy.com> <352D0231.E98A0106@elca-matrix.ch> Organization: Newsguy News Service [http://www.newsguy.com] Newsgroups: comp.lang.ada Date: 1998-04-09T00:00:00+00:00 List-Id: In article <352D0231.E98A0106@elca-matrix.ch>, Mats says... > >nabbasi@earthlink.net.NOSPAM wrote: > >> this takes care of synch. between tasks. but what about interrupts? >> an interrupt could occur anytime, and it also could establish an >> exception, and could end up in it , so this would lead >> to a race condition also on the global variable. > >What do you mean by interrupt ? I think the above is wrong. > >I don't see how you can end up in an exception handler asynchronously. >Asynchronous transfer of control is not defined in terms of exceptions (see RM >9.7.4). Or am I missing something ? > well, let me give an example. in VMS land, you can schedule an AST to occur at some time (a timer) , an AST is a procedure that will "fire" and starts executing at a higher IPL (interrupt priority level) than normal code. Also, you can do an asynchronous IO (write to a disk), and give an address of a procedure to execute when that IO operation is really complete. Then this procedure will execute as an AST, and will interrupt whatever the user mode process was doing at that time. Now, an AST is a normal procedure in all other way, except it runs as a higher IPL, (it is like a call back routine, except is interrupts the process whenever it wants) and so this procedure can if it wants, establish an exception handler when it starts running, and it can if it wants divide by zero after that, and so you can end up in an exception handler that is called from an interrupt routine running at high IPL and asynchronous to whatever the normal code was doing, which could have been in an exception handler also at the same time. Now, as I said, I did not know if one can associate an Ada procedure with a system interrupt. i.e. in the VMS example, I do not know if one can make a VMS system service from Ada and pass an address of an Ada procedure to be called as an AST (say when the IO is completed). Since certainly one can call VMS system services from Ada (there is an Ada binding for that), I would think one can also do the above in Ada, but it been long time since I played on VMS so I can be wrong. This sort of thing on VMS is not uncommon (programming with AST's), and it is flexible also, but needs careful programming to avoid problems with synchronizations between normal flow of code, and the AST flow of code. Nasser