nanogui: GrCheckNextEvent blocks when app linked into server
Subject:
Re: [nanogui] GrCheckNextEvent blocks when app linked into server
From:
Jordan Crouse ####@####.####
Date:
27 Aug 2001 14:25:53 -0000
Message-Id: <01082708250500.03501@cosmic>
It looks like you just need to add another case to the if statement to
compensate for the fact that you are esentially calling a select() that
should return immediately. It seems that GdGetNextTimeout() is not handling
the edge case of timeout being zero, so you should check for it yourself and
set the resuting 'to' accordingly:
if (timeout == 0)
to = 0;
else if (GdGetNextTimeout(&tout, timeout) == TRUE)
to = &tout;
else
to = NULL;
You could also add code to GdGetNextTimeout() to check for this situation,
but be careful that you don't break any timer handlers when you do. No time
should be elapsed from any of the timers for a GrCheckNextEvent() or
GrPeekEvent() call.
Jordan
On Monday 27 August 2001 00:27, Olaf Meeuwissen mentioned:
> Dear all,
>
> I've run into a little problem when linking my application into the
> server (0.89pre7). The same behaviour can be seen with the logfont
> demo in src/demos/nanox/. The font names will not appear until the
> application receives events. If you carefully generate your events
> you can control the speed at which font names appear.
>
> When running in a client/server setup everything is hunky-dory, but
> with the application linked into the server (-DNONETWORK), it waits
> for events because GrCheckNextEvent eventually calls GsSelect(0L).
>
> In GsSelect, the following piece of code blocks if GdGetNextTimeout
> returns false, which it does if (!timeout && !timerlist). That is,
> for timeout == 0 && !timerlist.
>
> /* Set up the timeout for the main select(): */
> if(GdGetNextTimeout(&tout, timeout) == TRUE)
> to = &tout;
> else to = NULL;
>
> /* Wait for some input on any of the fds in the set or a timeout: */
> if((e = select(setsize+1, &rfds, NULL, NULL, to)) > 0) {
>
> I've mucked around int GdGetNextTimeout and things work for me now but
> in doing so I've also badly broken the spec for GrGetNextEventTimeout
> and GrGetNextEvent.
>
> How do I fix this _cleanly_?
>
> Please CC as I'm not on the list.
>
> BTW, it'd be nice if the archive were searchable!