-
Notifications
You must be signed in to change notification settings - Fork 17
created the infrastructure for concurrent queues #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dietmarkuehl
wants to merge
41
commits into
main
Choose a base branch
from
conqueue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 e023c2e
clean-up some included headers which caused a bit of grief
dietmarkuehl 42e952a
implemented all but the async interface
dietmarkuehl 7fa110f
added async_push functionality
dietmarkuehl 3bc6553
added async_pop
dietmarkuehl 1faeac7
refactored how the bounded_queue works
dietmarkuehl f3f2c38
fixed a race
dietmarkuehl f23e722
try to working around an MSVC++ problem
dietmarkuehl 69ba1e0
another attempt at working around an MSVC++ problem with local classes
dietmarkuehl c2ef01a
addressed gcc warnings
dietmarkuehl b9cb7c9
addressed more gcc warnings
dietmarkuehl 7c2d57e
a few more warnings addressed
dietmarkuehl 0ec7565
addressed a remaining warning
dietmarkuehl d9cf895
Build with TSAN and clang-tidy (#100)
ClausKlein 683fc66
fixed new clang-tidy warnings
dietmarkuehl 8cb53dd
more warnings
dietmarkuehl 38d3f5b
addressed more clang-tidy warnings
dietmarkuehl 2ab503a
suppressing a seemingly spurious analyser warning
dietmarkuehl bd52128
trying to skip over errors from unknown options
dietmarkuehl c0bf0bd
exec.awaitables: fix completion sigs for void awaitables (#96)
maikel 0c3ae22
Remove unused print header in test (#99)
maikel 65983ef
Add pre-commit hooks (#102)
ClausKlein 73872dc
Check and format json and c++ files (#103)
ClausKlein ee2bdae
Fix clang tidy warnings (#105)
dietmarkuehl 8a9686b
fixed the return type of getting an element from an rvalue product_ty…
dietmarkuehl 01af87e
beman.execution26: change library status to under development (#104)
RaduNichita fc84954
Fix missing environment in sync_wait (#108)
maikel 35b7067
Change exported install name to beman::execution26 (#109)
maikel 9c1d681
Add on algorithm (#110)
dietmarkuehl 7b135bd
fixed a few coroutine related issues (#113)
dietmarkuehl 9e4bfb3
Fix coro issues (#114)
dietmarkuehl 4631504
simplied gather signatures (#116)
dietmarkuehl 21f0348
fix warnings (#117)
dietmarkuehl e3887dc
tried to reduce the uses of sender_decompose (#118)
dietmarkuehl 1992b3b
various minor fixes (#119)
dietmarkuehl bcf5bc9
avoid debug flags spilling into dependent projects (#120)
dietmarkuehl ae1ebe0
Avoid to export Debug flags (#121)
ClausKlein 3f8066e
Add examples (#122)
dietmarkuehl 4c4aa72
update .clang-tidy and CMakeLists.txt
dietmarkuehl 42ef6c3
fixed CMakeLists.txt
dietmarkuehl 732953d
fixed a few issues introduced when rebasing
dietmarkuehl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
24
include/beman/execution26/detail/async_concurrent_queue.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
30
include/beman/execution26/detail/basic_concurrent_queue.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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>>; | ||
maikel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
| } // namespace beman::execution26::detail | ||
|
|
||
| // ---------------------------------------------------------------------------- | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.