Skip to content

Commit e8ef023

Browse files
authored
rename exec::fork to exec::fork_join, fix msvc warnings (#1550)
1 parent 0ff3b68 commit e8ef023

9 files changed

Lines changed: 33 additions & 30 deletions

File tree

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
namespace exec {
2424
struct PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE { };
2525

26-
struct fork_t {
26+
struct fork_join_t {
2727
template <class Sndr, class... Closures>
2828
struct _sndr_t;
2929

@@ -135,12 +135,12 @@ namespace exec {
135135
using _env_t = stdexec::__call_result_t<stdexec::__env::__fwd_fn, stdexec::env_of_t<Rcvr>>;
136136
using _child_completions_t = stdexec::__completion_signatures_of_t<Sndr, _env_t>;
137137
using _domain_t = stdexec::__early_domain_of_t<Sndr, stdexec::__none_such>;
138-
using _when_all_sndr_t = fork_t::_when_all_sndr_t<_child_completions_t, Closures, _domain_t>;
138+
using _when_all_sndr_t = fork_join_t::_when_all_sndr_t<_child_completions_t, Closures, _domain_t>;
139139
using _child_opstate_t =
140140
stdexec::connect_result_t<Sndr, stdexec::__rcvr_ref_t<_opstate_t, _env_t>>;
141141
using _fork_opstate_t =
142142
stdexec::connect_result_t<_when_all_sndr_t, stdexec::__rcvr_ref_t<Rcvr>>;
143-
using _cache_sndr_t = fork_t::_cache_sndr_t<_variant_t<_child_completions_t>, _domain_t>;
143+
using _cache_sndr_t = fork_join_t::_cache_sndr_t<_variant_t<_child_completions_t>, _domain_t>;
144144

145145
STDEXEC_ATTRIBUTE(host, device)
146146

@@ -246,10 +246,10 @@ namespace exec {
246246
};
247247

248248
template <>
249-
struct fork_t::_env_t<stdexec::__none_such> { };
249+
struct fork_join_t::_env_t<stdexec::__none_such> { };
250250

251251
template <class Sndr, class... Closures>
252-
struct fork_t::_sndr_t {
252+
struct fork_join_t::_sndr_t {
253253
using sender_concept = stdexec::sender_t;
254254
using _closures_t = stdexec::__tuple_for<Closures...>;
255255

@@ -267,7 +267,7 @@ namespace exec {
267267
} else if constexpr (!__decay_copyable_results_t::value) {
268268
return _ERROR_<
269269
_WHAT_<>(PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE),
270-
_IN_ALGORITHM_(exec::fork_t)
270+
_IN_ALGORITHM_(exec::fork_join_t)
271271
>();
272272
} else {
273273
using _sndr_t = _when_all_sndr_t<_child_completions_t, _closures_t, _domain_t>;
@@ -297,10 +297,10 @@ namespace exec {
297297
return stdexec::__env::__fwd_fn{}(stdexec::get_env(sndr_));
298298
}
299299

300-
STDEXEC_ATTRIBUTE(no_unique_address) fork_t _tag_;
300+
STDEXEC_ATTRIBUTE(no_unique_address) fork_join_t _tag_;
301301
stdexec::__tuple_for<Closures...> _closures_;
302302
Sndr sndr_;
303303
};
304304

305-
inline constexpr fork_t fork{};
305+
inline constexpr fork_join_t fork_join{};
306306
} // namespace exec

include/exec/just_from.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace exec {
5858
template <class... Ts>
5959
requires stdexec::__sigs::__is_compl_sig<_set_tag_t(Ts...)>
6060
auto
61-
operator()(Ts&&... ts) const noexcept -> stdexec::completion_signatures<_set_tag_t(Ts...)> {
61+
operator()(Ts&&...) const noexcept -> stdexec::completion_signatures<_set_tag_t(Ts...)> {
6262
return {};
6363
}
6464
};

include/exec/system_context.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace exec {
7171
stdexec::set_stopped(std::forward<_Rcvr>(__rcvr_));
7272
}
7373

74-
[[no_unique_address]]
74+
STDEXEC_ATTRIBUTE(no_unique_address)
7575
_Rcvr __rcvr_;
7676
};
7777

@@ -412,10 +412,10 @@ namespace exec {
412412
__forward_args_helper_t)]{};
413413

414414
/// The function to be executed to perform the bulk work.
415-
[[no_unique_address]]
415+
STDEXEC_ATTRIBUTE(no_unique_address)
416416
_Fn __fun_;
417417
/// The receiver object that receives completion from the work described by the sender.
418-
[[no_unique_address]]
418+
STDEXEC_ATTRIBUTE(no_unique_address)
419419
_Rcvr __rcvr_;
420420

421421
/// Function that prepares the preallocated storage for calling the backend.
@@ -630,7 +630,7 @@ namespace exec {
630630
/// The size of the bulk operation.
631631
_Size __size_;
632632
/// The function to be executed to perform the bulk work.
633-
[[no_unique_address]]
633+
STDEXEC_ATTRIBUTE(no_unique_address)
634634
_Fn __fun_;
635635
};
636636

include/stdexec/__detail/__env.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ namespace stdexec {
678678
using __scheduler_t = __decay_t<_Scheduler>;
679679
using __sched_domain_t = __query_result_or_t<get_domain_t, __scheduler_t, default_domain>;
680680
_Scheduler __sched_;
681-
STDEXEC_ATTRIBUTE(no_unique_address) _LateDomain __late_domain_;
681+
STDEXEC_ATTRIBUTE(no_unique_address) _LateDomain __late_domain_{};
682682

683683
auto query(get_completion_scheduler_t<set_value_t>) const noexcept -> __scheduler_t {
684684
return __sched_;

include/stdexec/__detail/__read_env.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace stdexec {
120120
};
121121

122122
static constexpr auto submit =
123-
[]<class _Sender, class _Receiver>(const _Sender& __sndr, _Receiver __rcvr) noexcept
123+
[]<class _Sender, class _Receiver>(const _Sender&, _Receiver __rcvr) noexcept
124124
requires std::is_reference_v<__call_result_t<__data_of<_Sender>, env_of_t<_Receiver>>>
125125
{
126126
static_assert(sender_expr_for<_Sender, __read_env_t>);

include/stdexec/__detail/__sync_wait.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ namespace stdexec {
5959
return __loop_->get_scheduler();
6060
}
6161

62+
[[nodiscard]]
63+
constexpr auto query(__root_t) const noexcept -> bool {
64+
return true;
65+
}
66+
6267
// static constexpr auto query(__debug::__is_debug_env_t) noexcept -> bool {
6368
// return true;
6469
// }

test/exec/test_fork.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "exec/fork.hpp"
17+
#include "exec/fork_join.hpp"
1818
#include "exec/just_from.hpp"
1919
#include "test_common/type_helpers.hpp"
2020

@@ -23,13 +23,13 @@
2323
using namespace stdexec;
2424

2525
namespace {
26-
TEST_CASE("fork is a sender", "[adaptors][fork]") {
27-
auto sndr = exec::fork(just(), then([] { }));
26+
TEST_CASE("fork_join is a sender", "[adaptors][fork_join]") {
27+
auto sndr = exec::fork_join(just(), then([] { }));
2828
STATIC_REQUIRE(sender<decltype(sndr)>);
2929
}
3030

31-
TEST_CASE("fork is a sender in empty env", "[adaptors][fork]") {
32-
auto sndr = exec::fork(just(), then([] { }));
31+
TEST_CASE("fork_join is a sender in empty env", "[adaptors][fork_join]") {
32+
auto sndr = exec::fork_join(just(), then([] { }));
3333
STATIC_REQUIRE(sender_in<decltype(sndr), env<>>);
3434
STATIC_REQUIRE(
3535
set_equivalent<
@@ -38,7 +38,7 @@ namespace {
3838
>);
3939
}
4040

41-
TEST_CASE("fork broadcasts results to multiple continuations", "[adaptors][fork]") {
41+
TEST_CASE("fork_join broadcasts results to multiple continuations", "[adaptors][fork_join]") {
4242
auto fn = [](auto sink) {
4343
sink(42);
4444
return completion_signatures<
@@ -47,7 +47,7 @@ namespace {
4747
set_value_t(int, int, int)
4848
>{};
4949
};
50-
auto sndr = exec::fork(
50+
auto sndr = exec::fork_join(
5151
exec::just_from(fn),
5252
then([](auto&&... is) {
5353
CHECK(sizeof...(is) == 1);

test/exec/test_system_context.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616

1717
#include <thread>
18-
#include <iostream>
19-
#include <chrono>
2018

2119
#define STDEXEC_SYSTEM_CONTEXT_HEADER_ONLY 1
2220

@@ -310,21 +308,21 @@ struct my_parallel_scheduler_backend_impl
310308
};
311309

312310
struct my_inline_scheduler_backend_impl : scr::parallel_scheduler_backend {
313-
void schedule(std::span<std::byte> s, scr::receiver& r) noexcept override {
311+
void schedule(std::span<std::byte>, scr::receiver& r) noexcept override {
314312
r.set_value();
315313
}
316314

317315
void schedule_bulk_chunked(
318316
uint32_t count,
319-
std::span<std::byte> s,
317+
std::span<std::byte>,
320318
scr::bulk_item_receiver& r) noexcept override {
321319
r.execute(0, count);
322320
r.set_value();
323321
}
324322

325323
void schedule_bulk_unchunked(
326324
uint32_t count,
327-
std::span<std::byte> s,
325+
std::span<std::byte>,
328326
scr::bulk_item_receiver& r) noexcept override {
329327
for (uint32_t i = 0; i < count; ++i)
330328
r.execute(i, i + 1);

test/stdexec/algos/adaptors/test_bulk.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ namespace {
11031103
// The customization will return a different value
11041104
basic_inline_scheduler<my_domain> sched;
11051105
auto snd = ex::just(std::string{"hello"})
1106-
| exec::on(sched, ex::bulk(ex::par, 1, [&called](int, std::string x) {
1106+
| exec::on(sched, ex::bulk(ex::par, 1, [&called](int, std::string) {
11071107
called = true;
11081108
}));
11091109
wait_for_value(std::move(snd), std::string{"hijacked"});
@@ -1122,13 +1122,13 @@ namespace {
11221122
// The customization will return a different value
11231123
basic_inline_scheduler<my_domain2> sched;
11241124
auto snd = ex::just(std::string{"hello"}) | ex::continues_on(sched)
1125-
| ex::bulk(ex::par, 1, [&called](int, std::string x) { called = true; });
1125+
| ex::bulk(ex::par, 1, [&called](int, std::string) { called = true; });
11261126
wait_for_value(std::move(snd), std::string{"hijacked"});
11271127
REQUIRE_FALSE(called);
11281128

11291129
// bulk_chunked will still use the default implementation
11301130
auto snd2 = ex::just(std::string{"hello"}) | ex::continues_on(sched)
1131-
| ex::bulk_chunked(ex::par, 1, [&called](int, int, std::string x) { called = true; });
1131+
| ex::bulk_chunked(ex::par, 1, [&called](int, int, std::string) { called = true; });
11321132
wait_for_value(std::move(snd2), std::string{"hello"});
11331133
REQUIRE(called);
11341134
}

0 commit comments

Comments
 (0)