
Hi,
I've been playing around with Control.Concurrent lately, and ran into a
problem with xmonad as it stands: it usually blocks inside XNextEvent()
in the main loop, so the Haskell runtime system never gets a chance to
run any other lightweight threads.
The attached patch uses threadWaitRead to tell the runtime system to
wait for the X file descriptor to become ready before calling
XNextEvent. This works for me: I've now got a couple of forkIO threads
happily updating my status bar periodically.
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).
Thanks,
--
Adam Sampson