Skip to content

Commit e3df79c

Browse files
committed
Apply clang-tidy. Add get_system_scheduler as deprecated.
1 parent 4a6e213 commit e3df79c

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

include/exec/__detail/__system_context_default_impl.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ namespace exec::__system_context_default_impl {
9494
__r->set_stopped();
9595
}
9696

97-
decltype(auto) get_env() const noexcept {
97+
[[nodiscard]]
98+
auto get_env() const noexcept -> decltype(auto) {
9899
auto __o = __r_->try_query<stdexec::inplace_stop_token>();
99100
stdexec::inplace_stop_token __st = __o ? *__o : stdexec::inplace_stop_token{};
100101
return stdexec::prop{stdexec::get_stop_token, __st};
@@ -260,7 +261,7 @@ namespace exec::__system_context_default_impl {
260261
std::atomic<__parallel_scheduler_backend_factory> __factory_{__default_factory};
261262

262263
/// The default factory returns an instance of `_Impl`.
263-
static std::shared_ptr<_Interface> __default_factory() {
264+
static auto __default_factory() -> std::shared_ptr<_Interface> {
264265
return std::make_shared<_Impl>();
265266
}
266267

include/exec/system_context.hpp

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ namespace exec {
111111
struct __parallel_scheduler_env {
112112
/// Returns the system scheduler as the completion scheduler for `set_value_t`.
113113
template <stdexec::__one_of<stdexec::set_value_t> _Tag>
114+
[[nodiscard]]
114115
auto query(stdexec::get_completion_scheduler_t<_Tag>) const noexcept {
115116
return __detail::__make_parallel_scheduler_from(_Tag(), __scheduler_);
116117
}
@@ -222,7 +223,7 @@ namespace exec {
222223

223224
/// Implementation detail. Constructs the sender to wrap `__impl`.
224225
explicit __parallel_sender(__detail::__backend_ptr __impl)
225-
: __scheduler_{__impl} {
226+
: __scheduler_{std::move(__impl)} {
226227
}
227228

228229
/// Gets the environment of this sender.
@@ -232,8 +233,9 @@ namespace exec {
232233
}
233234

234235
/// Value completion happens on the parallel scheduler.
235-
parallel_scheduler
236-
query(stdexec::get_completion_scheduler_t<stdexec::set_value_t>) const noexcept;
236+
[[nodiscard]]
237+
auto query(stdexec::get_completion_scheduler_t<stdexec::set_value_t>) const noexcept
238+
-> parallel_scheduler;
237239

238240
/// Connects `__self` to `__rcvr`, returning the operation state containing the work to be done.
239241
template <stdexec::receiver _Rcvr>
@@ -450,6 +452,7 @@ namespace exec {
450452
}
451453

452454
/// Gets the environment of this receiver; returns the environment of the connected receiver.
455+
[[nodiscard]]
453456
auto get_env() const noexcept -> decltype(auto) {
454457
return stdexec::get_env(__state_.__rcvr_);
455458
}
@@ -593,8 +596,14 @@ namespace exec {
593596
return parallel_scheduler{std::move(__impl)};
594597
}
595598

596-
inline parallel_scheduler __parallel_sender::query(
597-
stdexec::get_completion_scheduler_t<stdexec::set_value_t>) const noexcept {
599+
[[deprecated("get_system_scheduler has been renamed get_parallel_scheduler")]]
600+
inline auto get_system_scheduler() -> parallel_scheduler {
601+
return get_parallel_scheduler();
602+
}
603+
604+
inline auto __parallel_sender::query(
605+
stdexec::get_completion_scheduler_t<stdexec::set_value_t>) const noexcept
606+
-> parallel_scheduler {
598607
return __detail::__make_parallel_scheduler_from(stdexec::set_value_t{}, __scheduler_);
599608
}
600609

test/exec/test_system_context.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ TEST_CASE(
280280

281281
TEST_CASE("empty environment always returns nullopt for any query", "[types][system_scheduler]") {
282282
struct my_receiver : scr::receiver {
283-
bool __query_env(__uuid, void*) noexcept override {
283+
auto __query_env(__uuid, void*) noexcept -> bool override {
284284
return false;
285285
}
286286

@@ -303,7 +303,7 @@ TEST_CASE("empty environment always returns nullopt for any query", "[types][sys
303303

304304
TEST_CASE("environment with a stop token can expose its stop token", "[types][system_scheduler]") {
305305
struct my_receiver : scr::receiver {
306-
bool __query_env(__uuid uuid, void* dest) noexcept override {
306+
auto __query_env(__uuid uuid, void* dest) noexcept -> bool override {
307307
if (
308308
uuid
309309
== scr::__runtime_property_helper<stdexec::inplace_stop_token>::__property_identifier) {

0 commit comments

Comments
 (0)