refactor
This commit is contained in:
@ -100,15 +100,16 @@ void tasks::stop() {
|
||||
stop_requested_ = true;
|
||||
|
||||
unique_mutex_lock lock(mutex_);
|
||||
std::vector<std::unique_ptr<std::jthread>> threads;
|
||||
std::swap(threads, task_threads_);
|
||||
|
||||
std::deque<scheduled_task> tasks;
|
||||
std::swap(tasks, tasks_);
|
||||
notify_.notify_all();
|
||||
lock.unlock();
|
||||
|
||||
task_threads_.clear();
|
||||
|
||||
lock.lock();
|
||||
tasks_.clear();
|
||||
notify_.notify_all();
|
||||
lock.unlock();
|
||||
threads.clear();
|
||||
tasks.clear();
|
||||
}
|
||||
|
||||
void tasks::task_thread() {
|
||||
|
Reference in New Issue
Block a user