Skip to content

Commit

Permalink
Merge branch 'add_callback' of https://github.com/NWChemEx/ParallelZone
Browse files Browse the repository at this point in the history
… into add_callback
  • Loading branch information
yzhang-23 committed Jan 22, 2024
2 parents 773d7c3 + 04b6a2d commit 08cc66b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/parallelzone/runtime/runtime_view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class RuntimeView {
* to add to the stack.
*
* @throw std::bad_alloc if there is problem adding the function to the
* stack. Strong throw guarantee.
* stack. Strong throw guarantee.
*/
void stack_callback(callback_function_type cb_func);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,22 @@ TEST_CASE("RuntimeViewPIMPL") {
}
REQUIRE(is_running == false);
}

SECTION("stack_callback II") {
// Testing the stack
int func_no = 1;
// Testing the stack
int func_no = 1;

// Two lambdas to be pushed into the stack
auto call_back_1 = [&func_no]() { func_no += 1; };
auto call_back_2 = [&func_no]() { func_no *= 2; };
// Two lambdas to be pushed into the stack
auto call_back_1 = [&func_no]() { func_no += 1; };
auto call_back_2 = [&func_no]() { func_no *= 2; };

// RuntimeViewPIMPL will fall off, call the turn_off lambda
// RuntimeViewPIMPL will fall off, call the turn_off lambda
{
RuntimeViewPIMPL rt_pimpl(false, comm, log);
rt_pimpl.stack_callback(call_back_1);
rt_pimpl.stack_callback(call_back_2);
rt_pimpl.stack_callback(call_back_2);
}

REQUIRE(func_no == 3);

}
}
1 change: 0 additions & 1 deletion tests/cxx/unit_tests/parallelzone/runtime/runtime_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ TEST_CASE("RuntimeView") {
}

REQUIRE(func_no == 3);

}

SECTION("gather") {
Expand Down

0 comments on commit 08cc66b

Please sign in to comment.