Skip to content

Commit

Permalink
event/Loop: remove failing assert()
Browse files Browse the repository at this point in the history
The `assert(!quit)` can fail if the `EventThread` gets stopped before
it enters `EventLoop::Run()`. There is a similar problem with `alive`,
which gets reset by `EventThread::Stop()`.

If that happens, then `EventLoop::Run()` should return immediately
without handling any events.
  • Loading branch information
MaxKellermann committed Aug 4, 2023
1 parent 7f61726 commit 6c8449e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/event/Loop.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ EventLoop::Run() noexcept
#endif

assert(IsInside());
assert(!quit);
#ifdef HAVE_THREADED_EVENT_LOOP
assert(!quit_injected);
assert(alive);
assert(alive || quit_injected);
assert(busy);

wake_event.Schedule(SocketEvent::READ);
Expand All @@ -303,7 +301,7 @@ EventLoop::Run() noexcept

FlushClockCaches();

do {
while (!quit) {
again = false;

/* invoke timers */
Expand Down Expand Up @@ -365,7 +363,7 @@ EventLoop::Run() noexcept

socket_event.Dispatch();
}
} while (!quit);
}

#ifdef HAVE_THREADED_EVENT_LOOP
#ifndef NDEBUG
Expand Down

0 comments on commit 6c8449e

Please sign in to comment.