comp.lang.ada
 help / color / mirror / Atom feed
From: nabbasi@earthlink.net
Subject: Re: In Exception ?
Date: 1998/04/09
Date: 1998-04-09T00:00:00+00:00	[thread overview]
Message-ID: <6gkafp$p31@drn.newsguy.com> (raw)
In-Reply-To: 352D0231.E98A0106@elca-matrix.ch


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




  reply	other threads:[~1998-04-09  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <35214b7a.0@news.profinet.at>
1998-04-04  0:00 ` In Exception ? Paul Van Bellinghen
1998-04-07  0:00   ` John Herro
1998-04-05  0:00 ` Corey Ashford
1998-04-07  0:00   ` nabbasi
1998-04-07  0:00     ` Corey Minyard
     [not found]     ` <Er1n22.24v@world.std.com>
1998-04-07  0:00       ` Robert Dewar
1998-04-09  0:00     ` Mats Weber
1998-04-09  0:00       ` nabbasi
1998-04-09  0:00     ` Mats Weber
1998-04-09  0:00       ` nabbasi [this message]
1998-04-10  0:00         ` Larry Kilgallen
replies disabled

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