Skip to content

Commit 94ec64a

Browse files
authored
Issue 174 (#176)
improve completion signals for schedule_from
1 parent f1eb609 commit 94ec64a

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

include/beman/execution/detail/schedule_from.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ struct impls_for<::beman::execution::detail::schedule_from_t> : ::beman::executi
130130
::std::monostate,
131131
::beman::execution::detail::meta::transform<
132132
::beman::execution::detail::as_tuple_t,
133-
::beman::execution::detail::meta::to<
134-
::std::variant,
135-
::beman::execution::detail::meta::combine<
136-
::beman::execution::completion_signatures_of_t<
137-
::beman::execution::detail::child_type<Sender>,
138-
::beman::execution::env_of_t<Receiver>>,
139-
//-dk:TODO get proper error completion signatures
140-
::beman::execution::completion_signatures<::beman::execution::set_error_t(
141-
::std::exception_ptr)>>>>>>;
133+
::beman::execution::detail::meta::to<::std::variant,
134+
::beman::execution::detail::meta::combine<
135+
::beman::execution::completion_signatures_of_t<
136+
::beman::execution::detail::child_type<Sender>,
137+
::beman::execution::env_of_t<Receiver>>,
138+
//-dk:TODO get proper error completion signatures
139+
::beman::execution::completion_signatures<
140+
::beman::execution::set_error_t(::std::exception_ptr),
141+
::beman::execution::set_stopped_t()>>>>>>;
142142

143143
return state_type<Receiver, sched_t, variant_t>(sch, receiver);
144144
}};

tests/beman/execution/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ list(APPEND todo exec-associate.test)
1212
list(
1313
APPEND
1414
execution_tests
15+
issue-174.test
1516
exec-scope-counting.test
1617
exec-spawn.test
1718
exec-stop-when.test
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// tests/beman/execution/issue-174.test.cpp *-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#include <beman/execution/execution.hpp>
5+
#include <thread>
6+
#include <utility>
7+
8+
namespace ex = beman::execution;
9+
10+
namespace {
11+
struct thread_loop : ex::run_loop {
12+
std::thread thread{[this] { this->run(); }};
13+
~thread_loop() {
14+
this->finish();
15+
this->thread.join();
16+
}
17+
};
18+
} // namespace
19+
20+
int main() {
21+
thread_loop ex_context1;
22+
thread_loop ex_context2;
23+
24+
ex::sync_wait(ex::just() | ex::then([] {}) | ex::continues_on(ex_context1.get_scheduler()) | ex::then([] {}) |
25+
ex::continues_on(ex_context2.get_scheduler()) | ex::then([] {}));
26+
}

0 commit comments

Comments
 (0)