Skip to content

Commit

Permalink
Merge branch 'develop' into multiple-parents
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Jul 29, 2024
2 parents a768f7a + 314bb8d commit 410fd89
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/apex/taskstubs_implementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ std::shared_ptr<apex::task_wrapper> safeLookup(
auto task = getMyMap().find(guid);
if (task == getMyMap().end()) {
// in the common map?
mtx.lock();
std::scoped_lock lock{mtx};
task = getCommonMap().find(guid);
mtx.unlock();
if (task == getCommonMap().end()) {
Expand Down Expand Up @@ -83,11 +83,14 @@ extern "C" {
// need to look up the parent shared pointers?
std::vector<std::shared_ptr<apex::task_wrapper>> parent_tasks;
for (uint64_t i = 0 ; i < parent_count ; i++) {
parent_tasks.push_back(safeLookup(parent_guids[i]));
auto tmp = safeLookup(parent_guids[i]);
if (tmp != nullptr)
parent_tasks.push_back(tmp);
}
// if no name, use address
if (timer_name == nullptr || strlen(timer_name) == 0) {
if (parent_count > 0) {
// TODO: need to handle multiple parents!
if (parent_tasks.size() > 0) {
auto task = apex::new_task(
(apex_function_address)function_address,
timer_guid, parent_tasks);
Expand All @@ -99,8 +102,9 @@ extern "C" {
safeInsert(timer_guid, task);
}
} else {
if (parent_count > 0) {
auto task = apex::new_task(timer_name, timer_guid, parent_tasks);
// TODO: need to handle multiple parents!
if (parent_tasks.size() > 0) {
auto task = apex::new_task(timer_name, timer_guid, parent_tasks[0]);
safeInsert(timer_guid, task);
} else {
auto task = apex::new_task(timer_name, timer_guid);
Expand Down

0 comments on commit 410fd89

Please sign in to comment.