Skip to content

Commit

Permalink
Update scheduler_common
Browse files Browse the repository at this point in the history
  • Loading branch information
kboyarinov committed Jul 3, 2024
1 parent 8562e9f commit 5e6b0f5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/tbb/scheduler_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <cstdint>
#include <exception>
#include <memory> // unique_ptr
#include <unordered_map>

//! Mutex type for global locks in the scheduler
using scheduler_mutex_type = __TBB_SCHEDULER_MUTEX_TYPE;
Expand Down Expand Up @@ -474,6 +475,9 @@ class alignas (max_nfs_size) task_dispatcher {
//! Suspend point (null if this task dispatcher has been never suspended)
suspend_point_type* m_suspend_point{ nullptr };

//! Used to improve scalability of d1::wait_context by using per thread reference_counter
std::unordered_map<d1::wait_tree_vertex_interface*, d1::reference_vertex*> m_reference_vertex_map;

//! Attempt to get a task from the mailbox.
/** Gets a task only if it has not been executed by its sender or a thief
that has stolen it from the sender's task pool. Otherwise returns nullptr.
Expand Down Expand Up @@ -502,6 +506,14 @@ class alignas (max_nfs_size) task_dispatcher {
m_suspend_point->~suspend_point_type();
cache_aligned_deallocate(m_suspend_point);
}

for (auto& elem : m_reference_vertex_map) {
d1::reference_vertex*& node = elem.second;
node->~reference_vertex();
cache_aligned_deallocate(node);
poison_pointer(node);
}

poison_pointer(m_thread_data);
poison_pointer(m_suspend_point);
}
Expand Down

0 comments on commit 5e6b0f5

Please sign in to comment.