[Xcb] some events got delayed significantly with epoll_pwait.

Ярослав Машко yaroslaw.mashko at gmail.com
Thu Jan 28 13:21:14 UTC 2021


Hello,

 Recently got migrated from Xlib to XCB. I had a setup that had some
sockets/fd's/signals in an epoll set. Now I need to change a layout of a
program. Had to add a computational task that will be called at a high rate
while program being run. At a rate about 1/100 per second. I am new to this
kind of work. I did some changes, adding POSIX timers, Linux timerfd, set
epoll_wait timeout to some approximate of task frequency.

 Now the above setup of mine have a problem. I do need some user
interaction with X server during program run. Take as example that the
window of a program may be closed by mouse click on 'X' button. Now with
the above, the event of window closing got delayed or even ignored to some
point in time. To explain further, I get a while(1) loop, with epoll_pwait
waiting on some set of fd's. The computation goes when timer expires or
epoll_wait timeout.

 Weird thing is that window focus/property/enter/leave events are delivered
at a rate of timeout(if such events do happen between timeouts), but some
events, such as keyboard interaction, window close and maybe more, got
queued and delivered at some later point in time. And more confusing to me,
is that if I send events to my program window at a high rate, for example
with moving a mouse constantly, the rate of _ALL_ event processing gets
higher.

 So my question and problem is, how to get a stable setup of interaction
with X server _and_ some high rate computational task. I prefer
multiplexing(select/poll/epoll). The ideal would be to not to change
anything and have a epoll_wait work as is.

Maybe the problem statement is a bit vague. I can supply some parts of code.

-- 
Ярослав Машко

+380990293574
+380989335496

live:yaroslaw.mashko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/xcb/attachments/20210128/25ca204b/attachment.htm>


More information about the Xcb mailing list