On Fri, Dec 16, 2016 at 11:24 AM, Antonin Houska <a...@cybertec.at> wrote:
> Antonin Houska <a...@cybertec.at> wrote: > > > It seems to be my bug. I'll check tomorrow. > > I could reproduce the problem by adding sufficient sleep time to the > loop. > > > Magnus Hagander <mag...@hagander.net> wrote: > >> I wonder if the else if (sleep > 0) at the bottom of throttle() should > just > >> be a simple else and always run, resetting last_throttle? > > I agree. In fact, I could simplify the code even more. > > Since (elapsed + sleep) almost equals to GetCurrentIntegerTimestamp(), we > can > use the following statement unconditionally (I think I tried too hard to > avoid > calling GetCurrentIntegerTimestamp too often in the original patch): > > throttled_last = GetCurrentIntegerTimestamp(); > > Thus we can also get rid of the "else" branch that clears both "sleep" and > "wait_result". > > (The patch contains minor comment refinement that I found useful when > seeing > the code after years.) > > Thanks! Applied and backpatched. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/