event/Loop: fix assertion failure due to wrong "busy" value

If an InjectEvent callback schedules a timer, the loop will restart,
but the "busy" flag is still false.  The fix is to move the "again"
check before the "busy" setting.
This commit is contained in:
Max Kellermann 2021-01-12 17:26:28 +01:00
parent bcb7e954e9
commit 906e82f600

View File

@ -326,15 +326,19 @@ EventLoop::Run() noexcept
{
const std::lock_guard<Mutex> lock(mutex);
HandleInject();
#endif
if (again)
/* re-evaluate timers because one of
the DeferEvents may have added a
new timeout */
continue;
#ifdef HAVE_THREADED_EVENT_LOOP
busy = false;
}
#endif
if (again)
/* re-evaluate timers because one of the
DeferEvents may have added a new timeout */
continue;
/* wait for new event */
Wait(timeout);