D26364: SlaveBase::dispatchLoop: Fix timeout calculation

Kevin Funk noreply at phabricator.kde.org
Thu Jan 2 13:23:34 GMT 2020


kfunk created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
kfunk requested review of this revision.

REVISION SUMMARY
  Old version of the code:
  
    ms = qMax<int>(d->nextTimeout.elapsed() - d->nextTimeoutMsecs, 1);
  
  ... will mean the sleep is for as long as the timer has run *minus* the
  intended duration, so if nextTimeoutMsecs is ever set and the timer just
  started this becomes very negative, and 1ms is the result.
  
  Inverting the subtraction:
  
    ms = qMax<int>(d->nextTimeoutMsecs - d->nextTimeout.elapsed(), 1);
  
  Means sleeping for the remaining time, and so far my CPU seems much
  happier, with my KIO-HTTP using apps looking fine.
  
  BUG: 392768

REPOSITORY
  R241 KIO

BRANCH
  master

REVISION DETAIL
  https://phabricator.kde.org/D26364

AFFECTED FILES
  src/core/slavebase.cpp

To: kfunk
Cc: kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200102/96693ae4/attachment.html>


More information about the Kde-frameworks-devel mailing list