[PosixEventEngine] Ensure threads are shut down before destroying other engine state (#31152)

* Add check for engine life on shutdown

This fixes a race condition where closures attempt to deregister themselves after the engine has been destroyed

* start initialized

* ensure threads are shut down before other engine state is destroyed
pull/31159/head
AJ Heller 2 years ago committed by GitHub
parent 7c4b87ede5
commit 68387a4e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/core/lib/event_engine/posix_engine/posix_engine.h

@ -107,12 +107,11 @@ class PosixEventEngine final : public EventEngine {
EventEngine::TaskHandle RunAfterInternal(Duration when,
absl::AnyInvocable<void()> cb);
posix_engine::TimerManager timer_manager_;
ThreadedExecutor executor_{2};
grpc_core::Mutex mu_;
TaskHandleSet known_handles_ ABSL_GUARDED_BY(mu_);
std::atomic<intptr_t> aba_token_{0};
posix_engine::TimerManager timer_manager_;
ThreadedExecutor executor_{2};
};
} // namespace experimental

Loading…
Cancel
Save