diff --git a/nano/lib/utility.cpp b/nano/lib/utility.cpp index a5d1135b..ede99219 100644 --- a/nano/lib/utility.cpp +++ b/nano/lib/utility.cpp @@ -281,7 +281,10 @@ void nano::worker::push_task (std::function func_a) { { nano::lock_guard guard (mutex); - queue.emplace_back (func_a); + if (!stopped) + { + queue.emplace_back (func_a); + } } cv.notify_one (); @@ -292,6 +295,7 @@ void nano::worker::stop () { nano::unique_lock lk (mutex); stopped = true; + queue.clear (); } cv.notify_one (); if (thread.joinable ())