[GAP] Deferred task aborting and get_immediate
Pierre Habraken
Pierre.Habraken at imag.fr
Thu Sep 7 12:31:27 CEST 2006
Arnaud Charlet wrote:
> [...]
> XNextEvent will typically return very frequently, so I suspect the abortion
> is actually not taking place during the XNextEvent call.
XNextEvent returns each time a user event is detected by the X server.
The program I consider is an X11 client. It connects to the X server and
then starts 2 tasks, the first one is listening to the X11 connection
via a blocking call to XNextEvent, the second one being listening to the
(console) keyboard via a blocking call to get_immediate.
At some time the user executes a dedicated action (mouse button press
within some given window) which is interpreted by the program as "do
terminate". Its reacts by aborting both listening tasks and then exiting
to the shell. I checked using gdb that just before being aborted, both
tasks are blocked waiting for an X11 event (1st one) or a key stroke
(2nd one).
My understanding is that, under Linux, a process being blocked executing
an I/O system call has state TASK_INTERRUPTIBLE ; that system call gets
aborted whenever a signal is sent to the process, enabling the process
to receive the signal. I assume that both Ada get_immediate and Xlib
XNextEvent end up in a read system call, and thus I would expect that
both should be aborted when the SIGABRT signal is received.
But things are probably not as simplistic as I figure, especially for
programs using threads...
Pierre
--
Pierre HABRAKEN - mailto:Pierre.Habraken at imag.fr
Tél: 04 76 82 72 46 - Fax: 04 76 82 72 87
IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
More information about the GAP
mailing list