diff --git a/phlex/utilities/async_driver.hpp b/phlex/utilities/async_driver.hpp index 435f90faf..1f3847a07 100644 --- a/phlex/utilities/async_driver.hpp +++ b/phlex/utilities/async_driver.hpp @@ -28,6 +28,7 @@ namespace phlex::experimental { if (gear_ == states::off) { thread_ = std::jthread{[this] { try { + gear_ = states::drive; driver_(*this); } catch (...) { cached_exception_ = std::current_exception(); @@ -35,7 +36,6 @@ namespace phlex::experimental { gear_ = states::park; cv_.notify_one(); }}; - gear_ = states::drive; } else { cv_.notify_one(); }