refactor
This commit is contained in:
@ -232,11 +232,14 @@ public:
|
|||||||
|
|
||||||
stop_requested_ = true;
|
stop_requested_ = true;
|
||||||
|
|
||||||
|
std::unique_ptr<std::thread> thread{nullptr};
|
||||||
|
std::swap(thread, event_thread_);
|
||||||
|
|
||||||
event_notify_.notify_all();
|
event_notify_.notify_all();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
event_thread_->join();
|
thread->join();
|
||||||
event_thread_.reset();
|
thread.reset();
|
||||||
|
|
||||||
process_events();
|
process_events();
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,11 @@ void single_thread_service_base::stop() {
|
|||||||
|
|
||||||
event_system::instance().raise<service_shutdown_begin>(service_name_);
|
event_system::instance().raise<service_shutdown_begin>(service_name_);
|
||||||
|
|
||||||
|
stop_requested_ = true;
|
||||||
|
|
||||||
std::unique_ptr<std::thread> thread{nullptr};
|
std::unique_ptr<std::thread> thread{nullptr};
|
||||||
std::swap(thread, thread_);
|
std::swap(thread, thread_);
|
||||||
|
|
||||||
stop_requested_ = true;
|
|
||||||
notify_.notify_all();
|
notify_.notify_all();
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user