Re: [AD] linux io

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Wed, Mar 28, 2001 at 02:45:41PM -0000, Vincent Penquerc'h wrote:
> this snippet of code is from src/linux/lasyncio.c:
> 
> /* async_io_event:
>  *  A handler for the SIGIO signal.  It used to be inelegant, more
>  *  optimised for speed, but I changed that because it was causing
>  *  problems (mouse motion stopped the keyboard responding).
>  */
> static RETSIGTYPE async_io_event(int signo)
> {
>    if (std_drivers[STD_MOUSE]) std_drivers[STD_MOUSE]->update();
>    if (std_drivers[STD_KBD]) std_drivers[STD_KBD]->update();
>    if (user_sigio_hook) user_sigio_hook(SIGIO);
>    return;
> }
> 
> 
> 
> i stumbled on it quite a while ago searching why there was a big speed
> difference in my program depending on whether the mouse was shown or not
> (we're talking almost 10% speedup there).

Having the mouse displayed or not won't affect the speed of this
stuff -- this will only be affected by whether the mouse is
installed or not.

> i was considering trying to find a way to speed it up, but i don't know
> what was here before. i guess this code was trying to get out of the
> routine as soon as it found something to update. is this right ?

Yes, pretty much, though IIRC it was more complicated than that.

It was going to be the case that the Linux version would have
several modes for getting async input -- there's SIGIO, threads,
or hooking SIGALRM.  I think at the moment there may be a
routine to switch modes, but I think SIGIO is the only one
that's implemented.  It should be simple to use SIGALRM checking
instead.  At the moment, each IO event will be calling this
signal handler, but if we use SIGALRM then the data will be
cached in the file buffers until the next alarm.  The
disadvantage is that the input will be less responsive (though
no worse than X is at the moment).

> what did this code look like before ? (this unfortunately was before
> the code was put on CVS).

Try downloading 3.9.18 -- I think that was the first 3.9.*
version with Linux support.

George



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/