First Last wrote:

> after some reads and looking at the event.c from jwm, my clock works!
> I'm using a structure like this :

>                 while(XPending(dpy)==0){
>                         usleep(100);
>                         updateClock(&myClock);
> 

Ugh. This causes the process to be scheduled up to 10,000 times per
second, which is almost a busy wait. I would expect this process to
consume far more CPU than is necessary.

It would be significantly more efficient to use select() or poll() on
the connection to the X server so that the process is only scheduled
when there is something for it to do. Or failing that, at least
increase the sleep interval substantially.

-- 
Glynn Clements <[email protected]>
_______________________________________________
[email protected]: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: [email protected]

Reply via email to