Skip to content

Commit 35225a6

Browse files
committed
Add parallel_scheduler scaffold
1 parent f302f66 commit 35225a6

6 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// include/beman/execution/detail/parallel_scheduler.hpp -*-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#ifndef INCLUDED_BEMAN_EXECUTION_DETAIL_PARALLEL_SCHEDULER
5+
#define INCLUDED_BEMAN_EXECUTION_DETAIL_PARALLEL_SCHEDULER
6+
7+
#include <beman/execution/detail/common.hpp>
8+
#ifdef BEMAN_HAS_IMPORT_STD
9+
import std;
10+
#else
11+
#include <cstddef>
12+
#include <concepts>
13+
#include <exception>
14+
#include <memory>
15+
#include <optional>
16+
#include <span>
17+
#include <type_traits>
18+
#include <utility>
19+
#endif
20+
#ifdef BEMAN_HAS_MODULES
21+
import beman.execution.detail.completion_signatures;
22+
import beman.execution.detail.get_completion_scheduler;
23+
import beman.execution.detail.get_forward_progress_guarantee;
24+
import beman.execution.detail.operation_state;
25+
import beman.execution.detail.receiver;
26+
import beman.execution.detail.scheduler;
27+
import beman.execution.detail.scheduler_t;
28+
import beman.execution.detail.sender;
29+
import beman.execution.detail.set_error;
30+
import beman.execution.detail.set_stopped;
31+
import beman.execution.detail.set_value;
32+
#else
33+
#include <beman/execution/detail/completion_signatures.hpp>
34+
#include <beman/execution/detail/get_completion_scheduler.hpp>
35+
#include <beman/execution/detail/get_forward_progress_guarantee.hpp>
36+
#include <beman/execution/detail/operation_state.hpp>
37+
#include <beman/execution/detail/receiver.hpp>
38+
#include <beman/execution/detail/scheduler.hpp>
39+
#include <beman/execution/detail/scheduler_t.hpp>
40+
#include <beman/execution/detail/sender.hpp>
41+
#include <beman/execution/detail/set_error.hpp>
42+
#include <beman/execution/detail/set_stopped.hpp>
43+
#include <beman/execution/detail/set_value.hpp>
44+
#endif
45+
46+
// ----------------------------------------------------------------------------
47+
48+
namespace beman::execution {
49+
50+
class parallel_scheduler {
51+
// TODO(P2079R10): add scheduler state and operations.
52+
};
53+
54+
// TODO(P2079R10): implement using system_context_replaceability::query_parallel_scheduler_backend().
55+
auto get_parallel_scheduler() -> parallel_scheduler;
56+
57+
} // namespace beman::execution
58+
59+
// ----------------------------------------------------------------------------
60+
61+
#endif // INCLUDED_BEMAN_EXECUTION_DETAIL_PARALLEL_SCHEDULER

include/beman/execution/execution.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import beman.execution.detail.let;
3939
import beman.execution.detail.matching_sig;
4040
import beman.execution.detail.on;
4141
import beman.execution.detail.operation_state;
42+
import beman.execution.detail.parallel_scheduler;
4243
import beman.execution.detail.prop;
4344
import beman.execution.detail.read_env;
4445
import beman.execution.detail.receiver;
@@ -101,6 +102,7 @@ import beman.execution.detail.write_env;
101102
#include <beman/execution/detail/matching_sig.hpp>
102103
#include <beman/execution/detail/on.hpp>
103104
#include <beman/execution/detail/operation_state.hpp>
105+
#include <beman/execution/detail/parallel_scheduler.hpp>
104106
#include <beman/execution/detail/prop.hpp>
105107
#include <beman/execution/detail/read_env.hpp>
106108
#include <beman/execution/detail/receiver.hpp>

src/beman/execution/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ target_sources(
133133
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/on_stop_request.hpp
134134
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/operation_state.hpp
135135
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/operation_state_task.hpp
136+
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/parallel_scheduler.hpp
136137
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/product_type.hpp
137138
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/prop.hpp
138139
${PROJECT_SOURCE_DIR}/include/beman/execution/detail/query_with_default.hpp
@@ -327,6 +328,7 @@ if(BEMAN_USE_MODULES)
327328
on.cppm
328329
operation_state_task.cppm
329330
operation_state.cppm
331+
parallel_scheduler.cppm
330332
product_type.cppm
331333
prop.cppm
332334
query_with_default.cppm

src/beman/execution/execution-detail.cppm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export import beman.execution.detail.non_assignable;
5959
export import beman.execution.detail.nothrow_callable;
6060
export import beman.execution.detail.notify;
6161
export import beman.execution.detail.operation_state_task;
62+
export import beman.execution.detail.parallel_scheduler;
6263
export import beman.execution.detail.product_type;
6364
export import beman.execution.detail.query_with_default;
6465
export import beman.execution.detail.queryable;

src/beman/execution/execution.cppm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import beman.execution.detail.never_stop_token;
4343
import beman.execution.detail.nostopstate;
4444
import beman.execution.detail.on;
4545
export import beman.execution.detail.operation_state; // [exec.opstate], operation states
46+
import beman.execution.detail.parallel_scheduler;
4647
import beman.execution.detail.prop;
4748
import beman.execution.detail.read_env;
4849
import beman.execution.detail.run_loop;
@@ -237,6 +238,10 @@ export using ::beman::execution::stopped_as_error;
237238
// [exec.run.loop], run_loop
238239
export using ::beman::execution::run_loop;
239240

241+
// [exec.parallel.scheduler], parallel scheduler
242+
export using ::beman::execution::parallel_scheduler;
243+
export using ::beman::execution::get_parallel_scheduler;
244+
240245
// [exec.consumers], consumers
241246
export using ::beman::execution::sync_wait_t;
242247
export using ::beman::execution::sync_wait_with_variant_t;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module;
2+
// src/beman/execution/parallel_scheduler.cppm -*-C++-*-
3+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
5+
#include <beman/execution/detail/parallel_scheduler.hpp>
6+
7+
export module beman.execution.detail.parallel_scheduler;
8+
9+
namespace beman::execution {
10+
export using beman::execution::parallel_scheduler;
11+
export using beman::execution::get_parallel_scheduler;
12+
} // namespace beman::execution

0 commit comments

Comments
 (0)