Skip to content

Commit

Permalink
Revert "move to execution and work-around a problem with the install"
Browse files Browse the repository at this point in the history
This reverts commit a56c3d6.
  • Loading branch information
dietmarkuehl committed Jan 27, 2025
1 parent a56c3d6 commit b153aa2
Show file tree
Hide file tree
Showing 22 changed files with 105 additions and 115 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ set(TARGET_NAME net)
set(TARGET_PREFIX beman.${TARGET_NAME})
set(TARGET_LIBRARY beman_${TARGET_NAME})
set(TARGET_ALIAS beman::${TARGET_NAME})
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME})
set(TARGETS_EXPORT_NAME ${CMAKE_PROJECT_NAME}Targets)

set(CMAKE_CXX_STANDARD 23)

include(FetchContent)
FetchContent_Declare(
execution
# for local development, use SOURCE_DIR <path-to>/execution
GIT_REPOSITORY https://github.com/bemanproject/execution
GIT_TAG e9c3032
execution26
# for local development, use SOURCE_DIR <path-to>/execution26
GIT_REPOSITORY https://github.com/bemanproject/execution26
GIT_TAG 752882e
)
FetchContent_MakeAvailable(execution)
FetchContent_MakeAvailable(execution26)

include(CTest)
if(BUILD_TESTING)
add_subdirectory(tests/beman/${TARGET_NAME})
enable_testing()
endif()

add_subdirectory(src/beman/${TARGET_NAME})
add_subdirectory(src/beman/net)
add_subdirectory(examples)

include(GNUInstallDirs)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It is based on [P2762R2](https://wg21.link/P2762R2). Both the proposal
and the implementation are in an early state although basic
functionality is provided.

`beman.net` builds on top of [`beman.execution`](https://github.com/bemanproject/execution). The
`beman.net` builds on top of [`beman.execution26`](https://github.com/bemanproject/execution26). The
implementation should allow multiple ways how to support asynchronous
operations although currently the only implemented approach is based
on `poll(2)`. Implementations using `kqueue(2)`, `epoll(2)`,
Expand Down
Binary file modified docs/cppcon-2024-slides.pdf
Binary file not shown.
1 change: 0 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ foreach(EXAMPLE ${EXAMPLES})
add_executable(${EXAMPLE_TARGET})
target_sources(${EXAMPLE_TARGET} PRIVATE ${EXAMPLE}.cpp)
target_link_libraries(${EXAMPLE_TARGET} PRIVATE ${TARGET_LIBRARY})
target_link_libraries(${EXAMPLE_TARGET} PRIVATE beman::execution)
endforeach()
2 changes: 1 addition & 1 deletion examples/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "demo_task.hpp"
#include "demo_scope.hpp"

namespace ex = ::beman::execution;
namespace ex = ::beman::execution26;
namespace net = ::beman::net;

// ----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions examples/cppcon-2024.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <beman/net/net.hpp>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include "demo_algorithm.hpp"
#include "demo_error.hpp"
#include "demo_scope.hpp"
Expand All @@ -14,7 +14,7 @@
#include <string_view>
#include <unordered_map>

namespace ex = beman::execution;
namespace ex = beman::execution26;
namespace net = beman::net;
using namespace std::chrono_literals;

Expand Down
11 changes: 5 additions & 6 deletions examples/demo_algorithm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ struct demo::into_error_t::sender
using sender_concept = ex::sender_t;
template <typename Env>
auto get_completion_signatures(Env const& env) const {
return ::beman::execution::detail::meta::transform<
return ::beman::execution26::detail::meta::transform<
demo::detail::into_error_transform<Fun>::template type,
decltype(ex::get_completion_signatures(::std::declval<Sender>(),
env))
Expand Down Expand Up @@ -269,7 +269,6 @@ struct demo::when_any_t::state_base
, receiver(::std::forward<R>(receiver))
{
}
virtual ~state_base() = default;
auto complete() -> bool
{
if (0u == this->done_count++)
Expand Down Expand Up @@ -387,7 +386,7 @@ struct demo::when_any_t::state<::std::index_sequence<I...>, Receiver, Value, Err
template <::std::size_t J>
using receiver_type = when_any_t::receiver<J, Receiver, value_type, error_type>;
using operation_state_concept = ex::operation_state_t;
using states_type = ::beman::execution::detail::product_type<
using states_type = ::beman::execution26::detail::product_type<
decltype(
demo::ex::connect(::std::declval<Sender>(),
::std::declval<receiver_type<I>>())
Expand Down Expand Up @@ -415,11 +414,11 @@ struct demo::when_any_t::state<::std::index_sequence<I...>, Receiver, Value, Err
template <demo::ex::sender... Sender>
struct demo::when_any_t::sender
{
::beman::execution::detail::product_type<::std::remove_cvref_t<Sender>...> sender;
::beman::execution26::detail::product_type<::std::remove_cvref_t<Sender>...> sender;
using sender_concept = ex::sender_t;
using completion_signatures =
::beman::execution::detail::meta::unique<
::beman::execution::detail::meta::combine<
::beman::execution26::detail::meta::unique<
::beman::execution26::detail::meta::combine<
decltype(ex::get_completion_signatures(::std::declval<Sender&&>(),
ex::empty_env{}))...
>
Expand Down
6 changes: 3 additions & 3 deletions examples/demo_scope.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ namespace demo
}
auto complete() -> void
{
scope* slf{this->self};
scope* self{this->self};
delete this->state;
if (0u == --slf->count)
if (0u == --self->count)
{
slf->complete();
self->complete();
}
}
auto get_env() const noexcept -> env { return {this->self}; }
Expand Down
12 changes: 5 additions & 7 deletions examples/demo_task.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace demo
struct task_state_base
{
::std::optional<T> task_result;
virtual ~task_state_base() = default;
virtual auto complete_value() -> void = 0;
virtual auto complete_error(::std::exception_ptr) -> void = 0;
virtual auto complete_stopped() -> void = 0;
Expand All @@ -42,7 +41,6 @@ namespace demo
template <>
struct task_state_base<void>
{
virtual ~task_state_base() = default;
virtual auto complete_value() -> void = 0;
virtual auto complete_error(::std::exception_ptr) -> void = 0;
virtual auto complete_stopped() -> void = 0;
Expand Down Expand Up @@ -116,12 +114,12 @@ namespace demo
this->awaiter->handle.resume();
}
template <typename Error>
auto set_error(Error&& err) noexcept -> void
auto set_error(Error&& error) noexcept -> void
{
if constexpr (::std::same_as<::std::decay_t<Error>, ::std::exception_ptr>)
this->awaiter->error = err;
this->awaiter->error = error;
else
this->awaiter->error = ::std::make_exception_ptr(::std::forward<Error>(err));
this->awaiter->error = ::std::make_exception_ptr(::std::forward<Error>(error));
this->awaiter->handle.resume();
}
auto set_stopped() noexcept -> void
Expand All @@ -148,9 +146,9 @@ namespace demo
auto stop() -> void;
auto get_token() const noexcept -> ex::inplace_stop_token;
constexpr auto await_ready() const noexcept -> bool { return false; }
auto await_suspend(::std::coroutine_handle<Promise> hndle) -> void
auto await_suspend(::std::coroutine_handle<Promise> handle) -> void
{
this->handle = hndle;
this->handle = handle;
ex::start(this->state);
}
auto await_resume()
Expand Down
4 changes: 2 additions & 2 deletions examples/empty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <beman/net/net.hpp>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include "demo_algorithm.hpp"
#include "demo_error.hpp"
#include "demo_scope.hpp"
Expand All @@ -14,7 +14,7 @@
#include <string_view>
#include <unordered_map>

namespace ex = beman::execution;
namespace ex = beman::execution26;
namespace net = beman::net;
using namespace std::chrono_literals;

Expand Down
4 changes: 2 additions & 2 deletions examples/http-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <beman/net/net.hpp>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include "demo_algorithm.hpp"
#include "demo_scope.hpp"
#include "demo_task.hpp"
Expand All @@ -13,7 +13,7 @@
#include <string_view>
#include <unordered_map>

namespace ex = beman::execution;
namespace ex = beman::execution26;
namespace net = beman::net;
using namespace std::chrono_literals;

Expand Down
4 changes: 2 additions & 2 deletions examples/milano.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <beman/net/net.hpp>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include "demo_algorithm.hpp"
#include "demo_error.hpp"
#include "demo_scope.hpp"
Expand All @@ -14,7 +14,7 @@
#include <string_view>
#include <unordered_map>

namespace ex = beman::execution;
namespace ex = beman::execution26;
namespace net = beman::net;
using namespace std::chrono_literals;

Expand Down
4 changes: 2 additions & 2 deletions examples/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
#include <iostream>
#include <functional>
#include <string_view>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include <beman/net/net.hpp>
#include "demo_algorithm.hpp"
#include "demo_scope.hpp"
#include "demo_task.hpp"

namespace ex = ::beman::execution;
namespace ex = ::beman::execution26;
namespace net = ::beman::net;
using namespace std::chrono_literals;

Expand Down
4 changes: 2 additions & 2 deletions examples/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#include <iostream>
#include <functional>
#include <string_view>
#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>
#include <beman/net/net.hpp>
#include "demo_scope.hpp"
#include "demo_task.hpp"

namespace ex = ::beman::execution;
namespace ex = ::beman::execution26;
namespace net = ::beman::net;

namespace
Expand Down
1 change: 0 additions & 1 deletion include/beman/net/detail/context_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ struct beman::net::detail::context_base
struct task
{
task* next;
virtual ~task() = default;
virtual auto complete() -> void = 0;
};

Expand Down
108 changes: 54 additions & 54 deletions include/beman/net/detail/execution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,76 +4,76 @@
#ifndef INCLUDED_INCLUDE_BEMAN_NET_DETAIL_EXECUTION
#define INCLUDED_INCLUDE_BEMAN_NET_DETAIL_EXECUTION

#include <beman/execution/execution.hpp>
#include <beman/execution26/execution.hpp>

// ----------------------------------------------------------------------------

namespace beman::net::detail::ex::detail
{
using ::beman::execution::detail::type_list;
using ::beman::execution::detail::variant_or_empty;
using ::beman::execution::detail::meta::combine;
using ::beman::execution::detail::meta::filter;
using ::beman::execution::detail::meta::unique;
using ::beman::execution::detail::meta::transform;
using ::beman::execution::detail::sender_adaptor;
using ::beman::execution::detail::forward_like;
using ::beman::execution26::detail::type_list;
using ::beman::execution26::detail::variant_or_empty;
using ::beman::execution26::detail::meta::combine;
using ::beman::execution26::detail::meta::filter;
using ::beman::execution26::detail::meta::unique;
using ::beman::execution26::detail::meta::transform;
using ::beman::execution26::detail::sender_adaptor;
using ::beman::execution26::detail::forward_like;
}

namespace beman::net::detail::ex
{
using ::beman::execution::completion_signatures;
using ::beman::execution::detail::decayed_tuple;
using ::beman::execution26::completion_signatures;
using ::beman::execution26::detail::decayed_tuple;

using ::beman::execution::get_env;
using ::beman::execution::empty_env;
using ::beman::execution::env_of_t;
using ::beman::execution::value_types_of_t;
using ::beman::execution::error_types_of_t;
using ::beman::execution26::get_env;
using ::beman::execution26::empty_env;
using ::beman::execution26::env_of_t;
using ::beman::execution26::value_types_of_t;
using ::beman::execution26::error_types_of_t;

using ::beman::execution::get_stop_token_t;
using ::beman::execution::get_stop_token;
using ::beman::execution::get_completion_signatures_t;
using ::beman::execution::get_completion_signatures;
using ::beman::execution::get_completion_scheduler_t;
using ::beman::execution::get_completion_scheduler;
using ::beman::execution::get_delegation_scheduler_t;
using ::beman::execution::get_delegation_scheduler;
using ::beman::execution::get_scheduler_t;
using ::beman::execution::get_scheduler;
using ::beman::execution26::get_stop_token_t;
using ::beman::execution26::get_stop_token;
using ::beman::execution26::get_completion_signatures_t;
using ::beman::execution26::get_completion_signatures;
using ::beman::execution26::get_completion_scheduler_t;
using ::beman::execution26::get_completion_scheduler;
using ::beman::execution26::get_delegation_scheduler_t;
using ::beman::execution26::get_delegation_scheduler;
using ::beman::execution26::get_scheduler_t;
using ::beman::execution26::get_scheduler;

using ::beman::execution::operation_state_t;
using ::beman::execution::operation_state;
using ::beman::execution::receiver_t;
using ::beman::execution::receiver;
using ::beman::execution::sender_t;
using ::beman::execution::sender;
using ::beman::execution::scheduler_t;
using ::beman::execution::scheduler;
using ::beman::execution26::operation_state_t;
using ::beman::execution26::operation_state;
using ::beman::execution26::receiver_t;
using ::beman::execution26::receiver;
using ::beman::execution26::sender_t;
using ::beman::execution26::sender;
using ::beman::execution26::scheduler_t;
using ::beman::execution26::scheduler;

using ::beman::execution::sender_in;
using ::beman::execution26::sender_in;

using ::beman::execution::set_error_t;
using ::beman::execution::set_error;
using ::beman::execution::set_stopped_t;
using ::beman::execution::set_stopped;
using ::beman::execution::set_value_t;
using ::beman::execution::set_value;
using ::beman::execution26::set_error_t;
using ::beman::execution26::set_error;
using ::beman::execution26::set_stopped_t;
using ::beman::execution26::set_stopped;
using ::beman::execution26::set_value_t;
using ::beman::execution26::set_value;

using ::beman::execution::connect_t;
using ::beman::execution::connect;
using ::beman::execution::start_t;
using ::beman::execution::start;
using ::beman::execution26::connect_t;
using ::beman::execution26::connect;
using ::beman::execution26::start_t;
using ::beman::execution26::start;

using ::beman::execution::read_env;
using ::beman::execution::detail::write_env;
using ::beman::execution::just;
using ::beman::execution::just_error;
using ::beman::execution::just_stopped;
using ::beman::execution::then;
using ::beman::execution::upon_error;
using ::beman::execution::upon_stopped;
using ::beman::execution::sync_wait;
using ::beman::execution26::read_env;
using ::beman::execution26::detail::write_env;
using ::beman::execution26::just;
using ::beman::execution26::just_error;
using ::beman::execution26::just_stopped;
using ::beman::execution26::then;
using ::beman::execution26::upon_error;
using ::beman::execution26::upon_stopped;
using ::beman::execution26::sync_wait;
}

// ----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit b153aa2

Please sign in to comment.