Skip to content

Commit d36d0d2

Browse files
committed
fixed a few issues
- remove fatal error when homebrew isn't used - added a simple build procedure to the Makefile - added an example using suspend_never - added completion signatures to inline_scheduler - removed some gibberish from store_receiver.hpp
1 parent b719b01 commit d36d0d2

File tree

6 files changed

+57
-4
lines changed

6 files changed

+57
-4
lines changed

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,23 @@ endif
107107
# TODO: beman.execution.examples.modules
108108
# FIXME: beman.execution.execution-module.test beman.execution.stop-token-module.test
109109

110-
default: module
110+
default: simple
111+
112+
SIMPLE_BUILD = build/simple-$(shell uname -s)
113+
114+
.PHONY: simple simple-configure simple-build simple-test
115+
116+
simple: simple-test
117+
118+
simple-config:
119+
cmake -G Ninja -S . -B $(SIMPLE_BUILD) -DBEMAN_USE_MODULES=OFF -DCXXFLAGS=
120+
121+
simple-build: simple-config
122+
CXXFLAGS= cmake --build $(SIMPLE_BUILD)
123+
124+
simple-test: simple-build
125+
ctest --test-dir $(SIMPLE_BUILD)
126+
111127

112128
all: $(SANITIZERS)
113129

cmake/prelude.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ if(
124124
# gersemi: on
125125
else()
126126
message(
127-
FATAL_ERROR
127+
STATUS
128128
"File does NOT EXISTS! ${CMAKE_CXX_STDLIB_MODULES_JSON}"
129129
)
130130
endif()

examples/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(PROJECT_IS_TOP_LEVEL)
1717
enable_testing()
1818
endif()
1919

20-
set(TODO stop_token) #-dk:TODO
20+
set(TODO stop_token) #-dk:TODO including that causes a linker error
2121
set(EXAMPLES
2222
allocator
2323
doc-just
@@ -31,6 +31,7 @@ set(EXAMPLES
3131
sender-demo
3232
stackoverflow
3333
stopping
34+
suspend_never
3435
when_all-cancel
3536
)
3637

examples/suspend_never.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include <beman/execution/execution.hpp>
2+
#include <iostream>
3+
#include <new>
4+
#include <memory>
5+
6+
namespace ex = beman::execution;
7+
8+
void* operator new(std::size_t n) {
9+
auto p = std::malloc(n);
10+
std::cout << "global new(" << n << ")->" << p << "\n";
11+
return p;
12+
}
13+
void operator delete(void* ptr) noexcept {
14+
std::cout << "global operator delete()" << ptr << "\n";
15+
}
16+
17+
int main() {
18+
struct resource: std::pmr::memory_resource {
19+
void* do_allocate(std::size_t n, std::size_t) override { return std::malloc(n); }
20+
void do_deallocate(void* p, std::size_t n, std::size_t) override { std::free(p); }
21+
bool do_is_equal(const std::pmr::memory_resource& other) const noexcept override{
22+
return this == &other;
23+
}
24+
} res{};
25+
26+
ex::sync_wait(
27+
ex::write_env(
28+
std::suspend_never(),
29+
ex::env{ex::prop{ex::get_allocator, std::pmr::polymorphic_allocator<std::byte>(&res)}}
30+
)
31+
);
32+
}

include/beman/execution/detail/inline_scheduler.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ struct inline_scheduler {
5353
struct sender {
5454
using sender_concept = ::beman::execution::sender_t;
5555
using completion_signatures = ::beman::execution::completion_signatures<::beman::execution::set_value_t()>;
56+
template <typename...>
57+
static consteval auto get_completion_signatures() noexcept -> completion_signatures {
58+
return {};
59+
}
5660

5761
static constexpr auto get_env() noexcept -> env { return {}; }
5862

include/beman/execution/detail/store_receiver.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//-dk:TODO rRW/// include/beman/execution/detail/store_receiver.hpp -*-C++-*-
1+
// include/beman/execution/detail/store_receiver.hpp -*-C++-*-
22
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
33

44
#ifndef INCLUDED_INCLUDE_BEMAN_EXECUTION_DETAIL_STORE_RECEIVER

0 commit comments

Comments
 (0)