[xmonad] Patch: Use threadWaitRead to avoid blocking in nextEvent in the main loop

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Jun 22 10:37:10 EDT 2008

On 2008 Jun 21, at 20:47, Adam Sampson wrote:

> I'm not entirely convinced it's correct, though. Is it possible for  
> the
> X server to send more than one event in a single communication? If so,
> it would be necessary to call nextEvent to handle the subsequent  
> events
> before the file descriptor becomes ready again (which'd be easy if
> there's a way to find out whether there are any events pending without
> blocking).

It is possible, and there are several ways to check (QLength(),  
XCheckIfEvent(), XPending(), XEventsQueued()) --- we probably want  
either XPending() or XEventsQueued(QueueAfterFlush) (same thing,  
different APIs).

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the xmonad mailing list