[GAP] Asynchroneus IO on Mac OS X

Alejandro R. Mosteo alejandro at mosteo.com
Fri Sep 8 09:16:47 CEST 2006


On 9/8/06, Christfried Webers <christfried.webers at ieee.org> wrote:
>
> While porting an Ada program running on Solaris and Linux to Mac OS X,
> I ran into the problem that I could not catch SIGIO signals via an
> installed signal handler (protected procedure). Before joining the GAP, I
> filed a report to ACT ([F411-002 public], see below), but as a public
> member I had no way of figuring out what happened with it.
>
> Therefore, I am still puzzled, whether there is any proper Ada way of
> catching the SIGIO on Mac OS X?
>
> As mentioned below, installing a handler via a C library call to
> sigaction() can solve the problem but completely by-passes the Ada runtime
> and that just doesn't feel right.
>
> Best
> Chris
>
> P.S.: My question has some relation to the previous thread:
> I choose asynchronous IO with signals in order to be able to properly
> release (but not kill!) the reading task after a timeout if NO data is
> coming in. With blocking IO, one just hangs on the IO call.


I'm throwing an idea, I'm not sure if it is doable, as another alternative
method for your problem. Use some "select" package to simultaneously wait
for IO on your desired data source and another descriptor, used internally
by your program to signal the timeout. You can thus block in the select call
and interrupt the IO in a controlled way.

If you were using sockets you already have this in Gnat.Sockets, in other
case I'm not aware of a select packet.

Best,

Alex.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/gap/attachments/20060908/504f9ac3/attachment.html


More information about the GAP mailing list