Skip to content

Commit 18c06dc

Browse files
authored
Merge pull request #30 from bemanproject/fixes
applied various fixes
2 parents 7bf30b0 + 891717f commit 18c06dc

26 files changed

+92
-55
lines changed

.github/workflows/ci_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ jobs:
140140
matrix:
141141
args:
142142
- name: "Disable build testing"
143-
arg: "-DBEMAN_LAZY_BUILD_TESTS=OFF"
143+
arg: "-DBEMAN_TASK_BUILD_TESTS=OFF"
144144
- name: "Disable example building"
145-
arg: "-DBEMAN_LAZY_BUILD_EXAMPLES=OFF"
145+
arg: "-DBEMAN_TASK_BUILD_EXAMPLES=OFF"
146146
name: "CMake: ${{ matrix.args.name }}"
147147
steps:
148148
- uses: actions/checkout@v4

CMakeLists.txt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ enable_testing()
1313

1414
# [CMAKE.SKIP_TESTS]
1515
option(
16-
BEMAN_LAZY_BUILD_TESTS
16+
BEMAN_TASK_BUILD_TESTS
1717
"Enable building tests and test infrastructure. Default: ON. Values: { ON, OFF }."
1818
${PROJECT_IS_TOP_LEVEL}
1919
)
20+
set(BEMAN_TASK_BUILD_TESTS FALSE)
2021

2122
# [CMAKE.SKIP_EXAMPLES]
2223
option(
23-
BEMAN_LAZY_BUILD_EXAMPLES
24+
BEMAN_TASK_BUILD_EXAMPLES
2425
"Enable building examples. Default: ON. Values: { ON, OFF }."
2526
${PROJECT_IS_TOP_LEVEL}
2627
)
@@ -33,28 +34,28 @@ set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)
3334

3435
FetchContent_Declare(
3536
execution
36-
# for local development, use SOURCE_DIR <path-to>/execution
37+
# SOURCE_DIR <path-to>/execution
3738
GIT_REPOSITORY https://github.com/bemanproject/execution
38-
GIT_TAG 9cd2e66
39+
GIT_TAG 578c05
3940
)
4041
FetchContent_MakeAvailable(execution)
4142
FetchContent_Declare(
4243
net
43-
# for local development, use SOURCE_DIR <path-to>/execution
44+
# SOURCE_DIR <path-to>/net
4445
GIT_REPOSITORY https://github.com/bemanproject/net
45-
GIT_TAG 193d043002143242731f9baf759efc6d624cace7
46+
GIT_TAG 53a8738
4647
)
4748
if(NOT WIN32)
4849
FetchContent_MakeAvailable(net)
4950
endif()
5051

5152
add_subdirectory(src/beman/task)
5253

53-
if(BEMAN_LAZY_BUILD_TESTS)
54+
if(BEMAN_TASK_BUILD_TESTS)
5455
add_subdirectory(tests/beman/task)
5556
endif()
5657

57-
if(BEMAN_LAZY_BUILD_EXAMPLES)
58+
if(BEMAN_TASK_BUILD_EXAMPLES)
5859
add_subdirectory(examples)
5960
endif()
6061

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ ifeq ($(UNAME),Darwin)
1010
endif
1111
BUILD = $(BUILDDIR)/$(PRESET)
1212

13-
default: doc
13+
default: compile
1414

1515
doc:
1616
cd docs; $(MAKE)
1717

1818
compile:
1919
CMAKE_EXPORT_COMPILE_COMMANDS=1 \
2020
cmake \
21-
--workflow --preset=$(PRESET)
21+
--workflow --preset=$(PRESET) \
2222

2323
list:
2424
cmake --workflow --list-presets

docs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
default: doc
44

55
doc: P3552-task.html
6-
cp generated/P3552-task.html generated/D3552-task.html
76

87
wg21/Makefile:
98
git clone https://github.com/mpark/wg21.git

examples/http-server.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// examples/http-server.cpp -*-C++-*-
2+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
3+
4+
#include <beman/execution/execution.hpp>
5+
#include <beman/execution/task.hpp>
6+
#include <beman/net/net.hpp>
7+
8+
namespace ex = beman::execution;
9+
namespace net = beman::net;
10+
11+
// ----------------------------------------------------------------------------
12+
13+
namespace {
14+
auto sched_spawn(auto&& scheduler, auto&& sender, auto&& token) {
15+
return ex::spawn(
16+
ex::write_env(std::forward<decltype(sender)>(sender) |
17+
ex::upon_error([](auto&&) noexcept { std::cout << "ERROR!\n"; }),
18+
ex::detail::make_env(ex::get_scheduler, std::forward<decltype(scheduler)>(scheduler))),
19+
std::forward<decltype(token)>(token));
20+
}
21+
} // namespace
22+
23+
int main() {
24+
net::io_context context{};
25+
ex::counting_scope scope{};
26+
27+
sched_spawn(
28+
context.get_scheduler(), ex::just() | ex::then([]() noexcept { std::cout << "hello\n"; }), scope.get_token());
29+
sched_spawn(
30+
context.get_scheduler(),
31+
[]() -> ex::task<> {
32+
std::cout << "hello\n";
33+
co_return;
34+
}(),
35+
scope.get_token());
36+
ex::sync_wait(scope.join());
37+
}

include/beman/task/detail/allocator_of.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// include/beman/task/detail/allocator_of.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#ifndef INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_ALLOCATOR_OF
5-
#define INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_ALLOCATOR_OF
4+
#ifndef INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_ALLOCATOR_OF
5+
#define INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_ALLOCATOR_OF
66

77
#include <concepts>
88
#include <memory>

include/beman/task/detail/allocator_support.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// include/beman/task/detail/allocator_support.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#ifndef INCLUDED_BEMAN_LAZY_DETAIL_ALLOCATOR_SUPPORT
5-
#define INCLUDED_BEMAN_LAZY_DETAIL_ALLOCATOR_SUPPORT
4+
#ifndef INCLUDED_BEMAN_TASK_DETAIL_ALLOCATOR_SUPPORT
5+
#define INCLUDED_BEMAN_TASK_DETAIL_ALLOCATOR_SUPPORT
66

77
#include <beman/task/detail/find_allocator.hpp>
88
#include <array>

include/beman/task/detail/completion.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// include/beman/task/detail/completion.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#ifndef INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_COMPLETION
5-
#define INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_COMPLETION
4+
#ifndef INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_COMPLETION
5+
#define INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_COMPLETION
66

77
#include <beman/execution/execution.hpp>
88

include/beman/task/detail/error_types_of.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// include/beman/task/detail/error_types_of.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#ifndef INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_ERROR_TYPES_OF
5-
#define INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_ERROR_TYPES_OF
4+
#ifndef INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_ERROR_TYPES_OF
5+
#define INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_ERROR_TYPES_OF
66

77
#include <beman/execution/execution.hpp>
88
#include <exception>

include/beman/task/detail/final_awaiter.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// include/beman/task/detail/final_awaiter.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

4-
#ifndef INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_FINAL_AWAITER
5-
#define INCLUDED_INCLUDE_BEMAN_LAZY_DETAIL_FINAL_AWAITER
4+
#ifndef INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_FINAL_AWAITER
5+
#define INCLUDED_INCLUDE_BEMAN_TASK_DETAIL_FINAL_AWAITER
66

77
#include <coroutine>
88

0 commit comments

Comments
 (0)