Commit 51b919f0 by FritzFlorian

Fix issue when re-using the main-thread and terminating the scheduler

parent 41b2f354
Pipeline #1263 failed with stages
in 49 seconds
...@@ -58,7 +58,7 @@ class locking_deque { ...@@ -58,7 +58,7 @@ class locking_deque {
"Must only push types of <Item> onto work_stealing_deque<Item>"); "Must only push types of <Item> onto work_stealing_deque<Item>");
std::lock_guard<base::spin_lock> lock{lock_}; std::lock_guard<base::spin_lock> lock{lock_};
auto deque_item = stack_->push(locking_deque_container<Item, T>{new_item}); auto deque_item = stack_->push<locking_deque_container<Item, T>>(new_item);
deque_item->item_ = &deque_item->content_; deque_item->item_ = &deque_item->content_;
if (tail_ != nullptr) { if (tail_ != nullptr) {
......
...@@ -81,6 +81,9 @@ void scheduler::terminate(bool wait_for_workers) { ...@@ -81,6 +81,9 @@ void scheduler::terminate(bool wait_for_workers) {
if (wait_for_workers) { if (wait_for_workers) {
for (unsigned int i = 0; i < num_threads_; i++) { for (unsigned int i = 0; i < num_threads_; i++) {
if (reuse_thread_ && i == 0) {
continue;
}
memory_->thread_for(i)->join(); memory_->thread_for(i)->join();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment