[GAP] Asynchroneus IO on Mac OS X

Ted Baker baker at cs.fsu.edu
Sun Sep 10 00:28:41 CEST 2006


> ... bypassing the Ada runtime is not a good idea.

In general, this depends on what you are trying to do with the
handler.  It is very difficult (I've heard some POSIX standards
people say impossible) to write portable correct code in C with
signal handlers.  However, something that is likely to work in C
is also likely to work in Ada if you interface to the C API.

Generally, you want to stay away from using any Ada feature that
you could not translate one-for-one to C, or for which the Ada
equivalent involves task-level locking.  Off the top of my head,
that seems to exclude at least exceptions or exception handlers,
tasking operations, dynamic storage allocation or deallocation,
and Ada I/O.  In general, it is hard to predict whether an Ada
library routine will do task-level locking to protect some shared
data, so library calls in general are likely to be unsafe.

However, I think it would always be be safe to install a null
function as a handler, using an interfaced call to sigaction.
This would override the default action of ignoring the signal, and
allow I/O operations to be interrupted.

--Ted


More information about the GAP mailing list