[Xcb] questions about proper event loop and timers

htom hto at arcor.de
Mon Aug 14 01:24:59 PDT 2006


Hi

I hit a similar problem just yesterday: Polling spikes the cpu, 
WaitForEvent blocks everything and I don't want to open an extra 
thread just for WaitForEvent. So:

> We could consider putting the timeout value of the select()s
> inside XCB under user control.  I'm not very excited about
> this, but perhaps others on the list feel differently?
I do not think this would help too much for larger programs. I mostly 
have a list of file descriptors which are polled with a select call. 
When using XCBs own select call is enough, it might be a good idea to 
allow a user defined timeout for the select.

> I would not recommend polling for events, nor trying to
> select on the XCB connection fd.  Both of these approaches
> have a high potential for problems, IMHO.
I tried the last thing via XCBGetFileDescriptor. When I get the file 
descriptor, do a select and the OS returns control to me, can I just 
do a XCBPollForEvent then? Why do you think that doing the select 
yourself has a high potential for problems?

Tom


More information about the Xcb mailing list