[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Xbindkeys-devel] Re: ghastly 10hz polling loop
From: |
Alexander Clouter |
Subject: |
[Xbindkeys-devel] Re: ghastly 10hz polling loop |
Date: |
Sun, 24 Jan 2010 10:52:40 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi,
* Philippe Brochard <address@hidden> [2010-01-23 23:58:32+0100]:
>
> > I have attached two patches that fix both these problems, the later
> > patch makes the polling optional (by default turned off as realistically
> > this file should not be amended regularly in the Real World[tm]).
> >
> Well, another solution is to increase the SLEEP_TIME variable to
> something less stressing for your battery (indeed 10hz is fairly
> quick for this purpose). BTW your patch can be useful and has been
> applied.
>
*Anything* that poll/select's with a timeout is a Bad Idea(tm). I was
tempted to use F_(SET|GET)LEASE as documented in fcntl(2) which should
do the job better than the current method, however as I cannot see the
poll'ing feature being use in production (only when people are trying to
get their configuration file perfected) it probably is not worth it and
could just overly complicate things.
Using inotify would have made the thing simplier, but that would have
made it a Linux only solution so not really an acceptable solution for
xbindkeys.
> > Please, next time run 'strace' on any code you write ;)
> >
> Thanks for the tip and many thanks for your patchs.
>
It's a real shame that X11 has to inform xbindkeys regarding *every*
keypress and that a filter cannot be further applied to trim the
unwanted keyboard input. Well, I could see anything glancing over the
Xlib documentation, you might know of a secret gem or two you can call
on though :)
> Please, can you can test them from the git repo before I do a new
> relase ?
>
> https://savannah.nongnu.org/projects/xbindkeys/
> https://savannah.nongnu.org/git/?group=xbindkeys
>
Seems to work perfectly here. I have attached an additional minor tweak
to stop the required initial stat()'s if we are not going to poll the
configuration files for changes.
Cheers
--
Alexander Clouter
.sigmonster says: You will overcome the attacks of jealous associates.
fixup.diff
Description: Text Data