Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix one more lifetime bug in ensure_started for cases when the sender is dropped without connecting it #797

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/linux_valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
shell: bash
run: |
cmake --build build --target tests.unit.modules.execution
cmake --build build --target std_thread_scheduler_test
- name: Test
shell: bash
run: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ namespace pika::ensure_started_detail {

template <typename Error>
friend void tag_invoke(pika::execution::experimental::set_error_t,
ensure_started_receiver&& r, Error&& error) noexcept
ensure_started_receiver r, Error&& error) noexcept
{
r.state->v.template emplace<error_type>(error_type(PIKA_FORWARD(Error, error)));
r.state->set_predecessor_done();
}

friend void tag_invoke(pika::execution::experimental::set_stopped_t,
ensure_started_receiver&& r) noexcept
ensure_started_receiver r) noexcept
{
r.state->set_predecessor_done();
};
Expand All @@ -188,7 +188,7 @@ namespace pika::ensure_started_detail {

template <typename... Ts>
friend auto tag_invoke(pika::execution::experimental::set_value_t,
ensure_started_receiver&& r, Ts&&... ts) noexcept
ensure_started_receiver r, Ts&&... ts) noexcept
-> decltype(std::declval<
pika::detail::variant<pika::detail::monostate, value_type>>()
.template emplace<value_type>(
Expand Down
9 changes: 5 additions & 4 deletions libs/pika/executors/tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ set(tests
thread_pool_scheduler
)

set(std_thread_scheduler_PARAMETERS VALGRIND)

# nvc++ causes test failures in release mode. This is assumed to be a code
# generation bug.
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "NVHPC")
Expand All @@ -33,8 +35,6 @@ endif()
foreach(test ${tests})
set(sources ${test}.cpp)

set(${test}_PARAMETERS THREADS 4)

source_group("Source Files" FILES ${sources})

set(folder_name "Tests/Unit/Modules/Executors")
Expand All @@ -47,6 +47,7 @@ foreach(test ${tests})
FOLDER ${folder_name}
)

pika_add_unit_test("modules.executors" ${test} ${${test}_PARAMETERS})

pika_add_unit_test(
"modules.executors" ${test} ${${test}_PARAMETERS} THREADS 4
)
endforeach()