Remove EventEngine::Shutdown (#27207)

It was determined that an explicit Shutdown method is not necessary, and further, it can be challenging to implement efficiently in some cases. Instead, EventEngines are expected to clean themselves up upon destruction. Anything that relies on an EventEngine's existence must coordinate itself to ensure the engine remains alive for as long as it's needed.
pull/27210/head
AJ Heller 3 years ago committed by GitHub
parent 2d16865693
commit 2f838fd3b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      include/grpc/event_engine/event_engine.h
  2. 7
      src/core/lib/iomgr/event_engine/iomgr.cc

@ -308,16 +308,6 @@ class EventEngine {
/// callback will be run exactly once from either cancellation or from its
/// activation.
virtual void TryCancel(TaskHandle handle) = 0;
/// Immediately run all callbacks with status indicating the shutdown. Every
/// EventEngine is expected to shut down exactly once. No new callbacks/tasks
/// should be scheduled after shutdown has begun, no new connections should be
/// created.
///
/// If the \a on_shutdown_complete callback is given a non-OK status, errors
/// are expected to be unrecoverable. For example, an implementation could
/// warn callers about leaks if memory cannot be freed within a certain
/// timeframe.
virtual void Shutdown(Callback on_shutdown_complete) = 0;
};
// TODO(hork): finalize the API and document it. We need to firm up the story

@ -20,7 +20,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/event_engine/promise.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/iomgr/tcp_server.h"
@ -52,12 +51,6 @@ void iomgr_platform_init(void) { GPR_ASSERT(g_event_engine != nullptr); }
void iomgr_platform_flush(void) {}
void iomgr_platform_shutdown(void) {
Promise<absl::Status> shutdown_status_promise;
g_event_engine->Shutdown([&shutdown_status_promise](absl::Status status) {
shutdown_status_promise.Set(std::move(status));
});
auto shutdown_status = shutdown_status_promise.Get();
GPR_ASSERT(shutdown_status.ok());
delete g_event_engine;
g_event_engine = nullptr;
}

Loading…
Cancel
Save