comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: asynchronos select question
Date: Thu, 25 Oct 2001 18:57:33 GMT
Date: 2001-10-25T18:57:33+00:00	[thread overview]
Message-ID: <xgZB7.433$xS6.893@www.newsranger.com> (raw)
In-Reply-To: 9r8nmb$l2j$1@e3k.asi.ansaldo.it

In article <9r8nmb$l2j$1@e3k.asi.ansaldo.it>, Paolo Argenton says...
>select
>    delay 5.0;
>    put_line (" timeout" );
>then abort
>    proc_with_blocking_io; -- i.e. wait for a byte to come from a serial
>line for istance
>end select;
>
>it never triggers the timeout part and waits forever, at least on NT+gnat

I haven't actually ever used this construct before (heck, I'd fogotten it
existed). But I'd guess that an abort of the abortable part is only possible
while you are within the language. If your Win32 thread is blocked waiting for
an I/O at the Operating System level, there is nothing Ada can do for you. So
what would probably happen here is that you will sit forever waiting for that IO
to complete. Once it does, the abortable part will get aborted, and you'd see
your "timeout" string (assuming there is still some Ada to execute after the I/O
completes).

For what you seem to be attempting to do, I think I'd use a task and a protected
type. The task services the I/O source, and the protected type implements a
queue of data read from the source. Then you can use a conditional or timed
entry call to read the data from the protected type (queue).

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html

No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



  reply	other threads:[~2001-10-25 18:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-25  9:54 asynchronos select question Paolo Argenton
2001-10-25 18:57 ` Ted Dennison [this message]
2001-10-25 23:30 ` Peter Hend�n
2001-11-02  4:17   ` David Brown
2001-11-02 11:15   ` Robert Dewar
replies disabled

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