Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2cdd844
created the infrastructure for concurrent queues
dietmarkuehl Dec 1, 2024
e023c2e
clean-up some included headers which caused a bit of grief
dietmarkuehl Dec 1, 2024
42e952a
implemented all but the async interface
dietmarkuehl Dec 1, 2024
7fa110f
added async_push functionality
dietmarkuehl Dec 2, 2024
3bc6553
added async_pop
dietmarkuehl Dec 2, 2024
1faeac7
refactored how the bounded_queue works
dietmarkuehl Dec 3, 2024
f3f2c38
fixed a race
dietmarkuehl Dec 3, 2024
f23e722
try to working around an MSVC++ problem
dietmarkuehl Dec 3, 2024
69ba1e0
another attempt at working around an MSVC++ problem with local classes
dietmarkuehl Dec 3, 2024
c2ef01a
addressed gcc warnings
dietmarkuehl Dec 3, 2024
b9cb7c9
addressed more gcc warnings
dietmarkuehl Dec 4, 2024
7c2d57e
a few more warnings addressed
dietmarkuehl Dec 4, 2024
0ec7565
addressed a remaining warning
dietmarkuehl Dec 4, 2024
d9cf895
Build with TSAN and clang-tidy (#100)
ClausKlein Dec 4, 2024
683fc66
fixed new clang-tidy warnings
dietmarkuehl Dec 4, 2024
8cb53dd
more warnings
dietmarkuehl Dec 4, 2024
38d3f5b
addressed more clang-tidy warnings
dietmarkuehl Dec 5, 2024
2ab503a
suppressing a seemingly spurious analyser warning
dietmarkuehl Dec 5, 2024
bd52128
trying to skip over errors from unknown options
dietmarkuehl Dec 5, 2024
c0bf0bd
exec.awaitables: fix completion sigs for void awaitables (#96)
maikel Dec 1, 2024
0c3ae22
Remove unused print header in test (#99)
maikel Dec 2, 2024
65983ef
Add pre-commit hooks (#102)
ClausKlein Dec 11, 2024
73872dc
Check and format json and c++ files (#103)
ClausKlein Dec 13, 2024
ee2bdae
Fix clang tidy warnings (#105)
dietmarkuehl Dec 22, 2024
8a9686b
fixed the return type of getting an element from an rvalue product_ty…
dietmarkuehl Dec 22, 2024
01af87e
beman.execution26: change library status to under development (#104)
RaduNichita Dec 22, 2024
fc84954
Fix missing environment in sync_wait (#108)
maikel Dec 23, 2024
35b7067
Change exported install name to beman::execution26 (#109)
maikel Dec 23, 2024
9c1d681
Add on algorithm (#110)
dietmarkuehl Jan 4, 2025
7b135bd
fixed a few coroutine related issues (#113)
dietmarkuehl Jan 9, 2025
9e4bfb3
Fix coro issues (#114)
dietmarkuehl Jan 10, 2025
4631504
simplied gather signatures (#116)
dietmarkuehl Jan 13, 2025
21f0348
fix warnings (#117)
dietmarkuehl Jan 13, 2025
e3887dc
tried to reduce the uses of sender_decompose (#118)
dietmarkuehl Jan 14, 2025
1992b3b
various minor fixes (#119)
dietmarkuehl Jan 14, 2025
bcf5bc9
avoid debug flags spilling into dependent projects (#120)
dietmarkuehl Jan 18, 2025
ae1ebe0
Avoid to export Debug flags (#121)
ClausKlein Jan 20, 2025
3f8066e
Add examples (#122)
dietmarkuehl Jan 20, 2025
4c4aa72
update .clang-tidy and CMakeLists.txt
dietmarkuehl Jan 21, 2025
42ef6c3
fixed CMakeLists.txt
dietmarkuehl Jan 21, 2025
732953d
fixed a few issues introduced when rebasing
dietmarkuehl Jan 21, 2025
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
17 changes: 17 additions & 0 deletions include/beman/execution26/conqueue.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// include/beman/execution26/conqueue.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_CONQUEUE
#define INCLUDED_BEMAN_EXECUTION26_CONQUEUE

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

#include <beman/execution26/detail/basic_concurrent_queue.hpp>
#include <beman/execution26/detail/concurrent_queue.hpp>
#include <beman/execution26/detail/async_concurrent_queue.hpp>
#include <beman/execution26/detail/conqueue_errc.hpp>
#include <beman/execution26/detail/conqueue_error.hpp>

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

#endif
24 changes: 24 additions & 0 deletions include/beman/execution26/detail/async_concurrent_queue.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// include/beman/execution26/detail/async_concurrent_queue.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_ASYNC_CONCURRENT_QUEUE
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_ASYNC_CONCURRENT_QUEUE

#include <beman/execution26/execution.hpp>
#include <beman/execution26/detail/basic_concurrent_queue.hpp>
#include <beman/execution26/detail/sender_of.hpp>
#include <utility>

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

namespace beman::execution26::detail {
template <typename T, typename Q>
concept async_concurrent_queue = ::beman::execution26::detail::basic_concurrent_queue<T, Q> && requires(Q q, T&& t) {
{ q.async_push(::std::forward<T>(t)) } noexcept -> ::beman::execution26::detail::sender_of<>;
{ q.async_pop() } noexcept -> ::beman::execution26::detail::sender_of<T>;
};
} // namespace beman::execution26::detail

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

#endif
30 changes: 30 additions & 0 deletions include/beman/execution26/detail/basic_concurrent_queue.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// include/beman/execution26/detail/basic_concurrent_queue.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_BASIC_CONCURRENT_QUEUE
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_BASIC_CONCURRENT_QUEUE

#include <concepts>
#include <optional>
#include <system_error>
#include <type_traits>
#include <utility>

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

namespace beman::execution26::detail {
template <typename T, typename Q>
concept basic_concurrent_queue =
::std::move_constructible<::std::remove_cvref_t<T>> && ::std::same_as<::std::decay_t<T>, typename Q::value_type> &&
requires(Q q, const Q qc, T&& t, ::std::error_code ec) {
{ qc.is_closed() } noexcept -> ::std::same_as<bool>;
{ q.close() } noexcept -> ::std::same_as<void>;
{ q.push(std::forward<T>(t)) } -> ::std::same_as<void>;
{ q.push(std::forward<T>(t), ec) } noexcept -> ::std::same_as<bool>;
{ q.pop(ec) } -> ::std::same_as<::std::optional<T>>;
{ q.pop() } -> ::std::same_as<T>;
};
} // namespace beman::execution26::detail
// ----------------------------------------------------------------------------

#endif
26 changes: 26 additions & 0 deletions include/beman/execution26/detail/concurrent_queue.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// include/beman/execution26/detail/concurrent_queue.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_CONCURRENT_QUEUE
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_CONCURRENT_QUEUE

#include <beman/execution26/detail/basic_concurrent_queue.hpp>
#include <concepts>
#include <optional>
#include <utility>
#include <system_error>

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

namespace beman::execution26::detail {
template <typename T, typename Q>
concept concurrent_queue =
::beman::execution26::detail::basic_concurrent_queue<T, Q> && requires(Q q, T&& t, ::std::error_code ec) {
{ q.try_push(::std::forward<T>(t), ec) } -> ::std::same_as<bool>;
{ q.try_pop(ec) } -> ::std::same_as<::std::optional<T>>;
};
} // namespace beman::execution26::detail

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

#endif
60 changes: 60 additions & 0 deletions include/beman/execution26/detail/conqueue_errc.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// include/beman/execution26/detail/conqueue_errc.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_CONQUEUE_ERRC
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_CONQUEUE_ERRC

#include <string>
#include <system_error>
#include <type_traits>

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

namespace beman::execution26 {
enum class conqueue_errc { empty, full, closed, busy };

inline auto conqueue_category() noexcept -> const ::std::error_category&;
inline auto make_error_code(::beman::execution26::conqueue_errc) noexcept -> ::std::error_code;
inline auto make_error_condition(::beman::execution26::conqueue_errc) noexcept -> ::std::error_condition;
} // namespace beman::execution26

namespace std {
template <>
struct is_error_code_enum<::beman::execution26::conqueue_errc> : ::std::true_type {};
} // namespace std

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

inline auto beman::execution26::conqueue_category() noexcept -> const ::std::error_category& {
struct category : ::std::error_category {
auto name() const noexcept -> const char* override { return "conqueue"; }
auto message(int value) const -> ::std::string override {
switch (value) {
default:
return "unknown";
case static_cast<int>(::beman::execution26::conqueue_errc::empty):
return "empty";
case static_cast<int>(::beman::execution26::conqueue_errc::full):
return "full";
case static_cast<int>(::beman::execution26::conqueue_errc::closed):
return "closed";
case static_cast<int>(::beman::execution26::conqueue_errc::busy):
return "busy";
}
}
};
static category rc{};
return rc;
}

inline auto beman::execution26::make_error_code(conqueue_errc e) noexcept -> ::std::error_code {
return ::std::error_code(static_cast<int>(e), ::beman::execution26::conqueue_category());
}

inline auto beman::execution26::make_error_condition(conqueue_errc e) noexcept -> ::std::error_condition {
return ::std::error_condition(static_cast<int>(e), ::beman::execution26::conqueue_category());
}

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

#endif
23 changes: 23 additions & 0 deletions include/beman/execution26/detail/conqueue_error.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// include/beman/execution26/detail/conqueue_error.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_CONQUEUE_ERROR
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_CONQUEUE_ERROR

#include <beman/execution26/detail/conqueue_errc.hpp>
#include <system_error>

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

namespace beman::execution26 {
class conqueue_error : public ::std::system_error {
public:
explicit conqueue_error(::beman::execution26::conqueue_errc ec)
: std::system_error(::beman::execution26::make_error_code(ec),
::beman::execution26::conqueue_category().message(static_cast<int>(ec))) {}
};
} // namespace beman::execution26

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

#endif
27 changes: 27 additions & 0 deletions include/beman/execution26/detail/sender_in_of.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// include/beman/execution26/detail/sender_in_of.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_SENDER_IN_OF
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_SENDER_IN_OF

#include <beman/execution26/detail/sender_in.hpp>
#include <beman/execution26/detail/matching_sig.hpp>
#include <beman/execution26/detail/set_value.hpp>
#include <beman/execution26/detail/value_types_of_t.hpp>
#include <beman/execution26/detail/value_signature.hpp>

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

namespace beman::execution26::detail {
template <typename Sender, typename Env, typename... A>
concept sender_in_of =
::beman::execution26::sender_in<Sender, Env> &&
::beman::execution26::detail::matching_sig<
::beman::execution26::set_value_t(A...),
::beman::execution26::
value_types_of_t<Sender, Env, ::beman::execution26::detail::value_signature, ::std::type_identity_t> >;
}

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

#endif
19 changes: 19 additions & 0 deletions include/beman/execution26/detail/sender_of.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// include/beman/execution26/detail/sender_of.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_SENDER_OF
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_SENDER_OF

#include <beman/execution26/detail/empty_env.hpp>
#include <beman/execution26/detail/sender_in_of.hpp>

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

namespace beman::execution26::detail {
template <typename Sender, typename... A>
concept sender_of = ::beman::execution26::detail::sender_in_of<Sender, ::beman::execution26::empty_env, A...>;
}

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

#endif
18 changes: 18 additions & 0 deletions include/beman/execution26/detail/value_signature.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// include/beman/execution26/detail/value_signature.hpp -*-C++-*-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#ifndef INCLUDED_BEMAN_EXECUTION26_DETAIL_VALUE_SIGNATURE
#define INCLUDED_BEMAN_EXECUTION26_DETAIL_VALUE_SIGNATURE

#include <beman/execution26/detail/set_value.hpp>

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

namespace beman::execution26::detail {
template <typename... A>
using value_signature = ::beman::execution26::set_value_t(A...);
}

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

#endif
17 changes: 17 additions & 0 deletions src/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ target_sources(
BASE_DIRS
${PROJECT_SOURCE_DIR}/include
FILES
${PROJECT_SOURCE_DIR}/include/beman/execution26/conqueue.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/execution.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/functional.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/stop_token.hpp
Expand All @@ -39,8 +40,12 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/apply_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/as_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/as_except_ptr.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/async_concurrent_queue.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/atomic_intrusive_stack.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/await_result_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/await_suspend_result.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/awaitable_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_concurrent_queue.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_operation.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_receiver.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/basic_sender.hpp
Expand All @@ -49,21 +54,25 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/callable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/check_type_alias_exist.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/child_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/class_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/common.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_domain.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_signature.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_signatures.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_signatures_for.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_signatures_of_t.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/completion_tag.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/concurrent_queue.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/connect.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/connect_all.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/connect_all_result.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/connect_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/connect_result_t.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/conqueue_errc.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/continues_on.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_same_as.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_tuple.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_type_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decayed_typeof.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/decays_to.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/default_domain.hpp
Expand Down Expand Up @@ -97,6 +106,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/indirect_meta_apply.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/inplace_stop_source.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/into_variant.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/intrusive_stack.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/is_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/is_awaiter.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/join_env.hpp
Expand Down Expand Up @@ -138,9 +148,12 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_adaptor.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_adaptor_closure.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_awaitable.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_decompose.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_for.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_in.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_in_of.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sender_of.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/sends_stopped.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/set_error.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/set_stopped.hpp
Expand All @@ -149,6 +162,7 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/simple_counting_scope.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/single_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/single_sender_value_type.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/split.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/start.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/starts_on.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/state_type.hpp
Expand All @@ -165,15 +179,18 @@ target_sources(
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/then.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/transform_sender.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/type_list.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/unspecified_promise.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/unstoppable_token.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/valid_completion_for.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/valid_completion_signatures.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/valid_specialization.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/value_signature.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/value_types_of_t.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/variant_or_empty.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/when_all.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/when_all_with_variant.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/with_await_transform.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/with_awaitable_senders.hpp
${PROJECT_SOURCE_DIR}/include/beman/execution26/detail/write_env.hpp
)

Expand Down
5 changes: 5 additions & 0 deletions tests/beman/execution26/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ endif()
list(
APPEND
execution_tests
conqueue-error.test
conqueue-errc.test
async-concurrent-queue.test
concurrent-queue.test
basic-concurrent-queue.test
notify.test
exec-scounting.test
exec-awaitable.test
Expand Down
Loading
Loading