On 09/12/2013 07:43 PM, Amos Jeffries wrote: > On 13/09/2013 4:48 a.m., Alex Rousskov wrote:
> +EventScheduler::timeRemaining() const > { > + if (tasks) { > + const int diff = static_cast<int>((tasks->when - current_dtime) * > 1000); > + return max(diff, 0); > + } > + return EVENT_IDLE; > } ... > + int result = timeRemaining(); > + if (result != 0) > + return result; > + do { > + ev_entry *event = tasks; > + assert(event); > Please do not add an assertion into the main event loop. Why not? I think it is appropriate in this context. I do not think it will trigger today, but if we screw up timeRemaining() so that it gets out of sync again, the assertion will trigger (and probably often!). > And thank you, this kind of explains the mystery 100% CPU reports still > coming in and unable to be replicated. One could only hope. While it is possible that this is the culprit, I suspect it is not, unfortunately -- a lot of things must align just right for this problem to cause persistent 100% CPU usage AFAICT. Thank you, Alex.