Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/beman/execution/detail/as_awaitable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace beman::execution {
*/
struct as_awaitable_t {
template <typename Expr, typename Promise>
auto operator()(Expr&& expr, Promise& promise) const {
auto operator()(Expr&& expr, Promise& promise) const -> decltype(auto) {
if constexpr (requires { ::std::forward<Expr>(expr).as_awaitable(promise); }) {
static_assert(
::beman::execution::detail::is_awaitable<decltype(::std::forward<Expr>(expr).as_awaitable(promise)),
Expand Down
10 changes: 4 additions & 6 deletions include/beman/execution/detail/let.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import std;
#else
#include <concepts>
#include <exception>
#include <functional>
#include <tuple>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -271,12 +272,9 @@ struct let_t {
{}};
}};
template <typename Receiver, typename... Args>
static auto
let_bind(auto& state, Receiver& receiver, Args&&... args) noexcept(noexcept(::beman::execution::connect(
::std::apply(::std::move(state.fun),
::std::move(state.args.template emplace<::beman::execution::detail::decayed_tuple<Args...>>(
::std::forward<Args>(args)...))),
let_receiver<Receiver, decltype(state.env)>{receiver, state.env}))) {
static auto let_bind(auto& state, Receiver& receiver, Args&&... args) noexcept(
noexcept(::beman::execution::connect(::std::invoke(::std::move(state.fun), ::std::forward<Args>(args)...),
let_receiver<Receiver, decltype(state.env)>{receiver, state.env}))) {
using args_t = ::beman::execution::detail::decayed_tuple<Args...>;
auto mkop{[&] {
return ::beman::execution::connect(
Expand Down
6 changes: 2 additions & 4 deletions include/beman/execution/detail/run_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,8 @@ class run_loop {
}
}
auto finish() -> void {
{
::std::lock_guard guard(this->mutex);
this->current_state = state::finishing;
}
::std::lock_guard guard(this->mutex);
this->current_state = state::finishing;
this->condition.notify_one();
}
};
Expand Down
8 changes: 7 additions & 1 deletion tests/beman/execution/exec-spawn.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import beman.execution;
import beman.execution.detail;
#else
#include <beman/execution/detail/just.hpp>
#include <beman/execution/detail/let.hpp>
#include <beman/execution/detail/spawn.hpp>
#include <beman/execution/detail/sender.hpp>
#include <beman/execution/detail/receiver.hpp>
Expand Down Expand Up @@ -188,11 +190,15 @@ auto test_spawn() {
ASSERT(associated == false);
ASSERT(disassociated == false);
}
static_assert(requires {
test_std::spawn(test_std::just_error(0) | test_std::let_error([](int) noexcept { return test_std::just(); }),
std::declval<token<true>>());
});
}

} // namespace

TEST(exec_spawn_future) {
TEST(exec_spawn) {
static_assert(std::same_as<decltype(test_std::spawn), const test_std::spawn_t>);
test_overload<true>(sender<true>{}, token<true>{}, env{});
test_overload<false>(sender<false>{}, token<true>{}, env{});
Expand Down
Loading