[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lynx-dev] options pane quirks
From: |
Bela Lubkin |
Subject: |
Re: [Lynx-dev] options pane quirks |
Date: |
Fri, 17 Sep 2004 17:45:21 -0700 |
Gisle Vanem wrote:
> > I didn't see any sub-second sleeper, so I added one using select().
> > It's an error to use select() like this on Windows. Hope other targets
> > allow this (i.e. all fd_set to NULL).
>
> Ops, something like this is better. I couldn't test this with djgpp
> version under Win-XP since S-Lang doesn't seem to support under Win-XP.
>
> #ifdef USE_MOUSE
> static void mouse_select_delay (int msec)
> {
> #ifdef _WINDOWS
> Sleep (msec);
> #else
> struct timeval tv;
>
> msec *= 1000;
> tv.tv_sec = msec / 1000000L;
> tv.tv_usec = msec % 1000000L;
> (void) select (0, NULL, NULL, NULL, &tv);
> #endif
> }
> #endif
This should not be presented as a mouse-specific function. If existing
facilities inside Lynx aren't adequate, add a new generic function e.g.
`msec_delay()'.
The _contents_ of that function will, over time, become a snarled mess
of #ifdefs. You've made a start on that.
BTW, for debugging purposes it's best not to change the args passed to a
function. If Lynx dumped core while in a `mouse_select_delay(20)' call,
a stack dump would show `mouse_select_delay(20000)', which might confuse
some future person trying to debug Lynx.
>Bela<