[GAP] Deferred task aborting and get_immediate

Arnaud Charlet charlet at adacore.com
Thu Sep 7 10:10:18 CEST 2006


> I agree, however I can't figure how to terminate without "killing" it a 
> task which is blocked in an I/O call.

You cannot, you need to use some kind of polling.

> A workaround could be to periodically poll the keyboard input, using non 
> blocking get_immediate. But I don't like it because it generates 
> unnecessary context switches and processor time wasting.

You just need to use proper timeouts to avoid using too much cpu.

> BTW, a task using blocking reads on a network socket (XNextEvent Xlib 
> primitive, see below) gently terminates when asynchronously aborted. I 
> suppose that this is because the Xlib and the Gnat runtime do manage I/O 
> calls in a different way each one...

XNextEvent will typically return very frequently, so I suspect the abortion
is actually not taking place during the XNextEvent call.

Arno


More information about the GAP mailing list