[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obscure timing issue

From: Wolfgang Lux
Subject: Re: Obscure timing issue
Date: Wed, 10 Dec 2008 13:54:44 +0100

Richard Frith-Macdonald wrote:

Ah ... so if I understand correctly, you are saying that the X library checks and reads from the socket at times *other* than when we call XPending() in the handler which deals with run loop events. Thus there is a window between us checking for pending events and us telling the runloop to watch the socket, in which the x library can read the events we are expecting from the socket.

Indeed, this is what happens. I guess the code which highlights the button (rather redraws the window, but that is another issue) is requesting some information from the server in this particular case.

I think there is a possible workaround for this in our runloop code in gnustep-base ... As well as the -receivedEvent:type:extra:forMode: method that the backend code uses to handle events, it can also implement the - runLoopShouldBlock: method to tell the run loop how to behave before doing the select/poll.

So it could be something like:

- (BOOL) runLoopShouldBlock: (BOOL*)trigger
  *trigger = YES;       //  Should trigger this event
 if (XPending(dpy) > 0)
      return NO;        // Don't block
  return YES;

I gave it a quick try and it solves issue. Thanks Richard.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]