KIdleTime : provide a settable resolution for the polling backends?
Martin Graesslin
mgraesslin at kde.org
Tue Nov 17 07:42:31 UTC 2015
On Monday, November 16, 2015 1:31:02 PM CET René J.V. Bertin wrote:
> Hi,
>
> Working on modernising the OS X plugin for KIdleTime, I realised that there
> is no mechanism foreseen to set the frequency at which the current system
> idle time should be sampled on those platforms that need to use a polling
> approach (OS X, MS Windows and apparently also XScreenSaver).
Maybe you see something which I do not: where does XScreenSaver use polling?
>
> The frequency with which idle time is polled (sampled) determines the delay
> with which the resumingFromIdle signal can be sent, but also the precision
> of the timeoutReached signals.
>
> At the moment I'm using a QTimer interval of 0 to poll idle time, meaning
> the timer fires and idletime is fired about as fast as possible when there
> are no events to process. That is fine for a system that wants to react as
> fast as possible to the end of an idle period, but probably overkill in
> many other situations. It strikes me that the required resolution is
> something that only the calling code can know, though there are probably
> several values that are reasonable defaults (10x per second seems a bit
> much, 4x maybe just too low).
>
> Thoughts?
Don't poll. Never ever, don't poll. That's the opposite of what an application
wants to do. The application wants to sleep till there is an event where it
should do something. Keeping the application in a busy loop is the exact
opposite So don't poll.
I know that is easy said, but in the end I think it's better to not provide
the feature than to perform polling. I don't see a problem with a specific
feature not being available. Consider for example my implementation for
Wayland (in kwayland-integration). I had the complete control over the
platform, but decided not to add support for supporting the forcePollRequest.
Please find a solution which doesn't use polling.
Cheers
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20151117/8b8ca184/attachment.sig>
More information about the Kde-frameworks-devel
mailing list