diff --git a/tvm-python/PyLiteClient.h b/tvm-python/PyLiteClient.h index b524dd302..514252dc8 100644 --- a/tvm-python/PyLiteClient.h +++ b/tvm-python/PyLiteClient.h @@ -230,8 +230,10 @@ class PyLiteClient { void stop() { scheduler_.run_in_context_external([&] { send_closure(engine, &LiteClientActorEngine::exit); }); + scheduler_.run_in_context_external([&] { engine.reset(); }); scheduler_.run_in_context_external([] { td::actor::SchedulerContext::get()->stop(); }); scheduler_thread_.join(); + scheduler_.stop(); } private: