Skip to content

Commit

Permalink
Merge branch 'develop' into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Haim committed Nov 18, 2023
2 parents 42600d0 + 406d585 commit f59843a
Show file tree
Hide file tree
Showing 42 changed files with 854 additions and 335 deletions.
2 changes: 1 addition & 1 deletion .github/actions/fetch-clang/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runs:
Invoke-NativeCommand sudo apt-key add $tmp
$tmp | Remove-Item
Invoke-NativeCommand sudo add-apt-repository -y "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${version} main"
Invoke-NativeCommand sudo apt-get update
Invoke-NativeCommand sudo apt-get update && sudo apt-get upgrade
$pkgs = @("clang-${version}", "libc++-${version}-dev", "libc++abi-${version}-dev")
if (${version} -eq 12) {
$pkgs += "libunwind-${version}-dev"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ jobs:
args: >
-DBUILD_SHARED_LIBS=${{ matrix.shared }}
-DENABLE_THREAD_SANITIZER=${{ matrix.tsan }}
-DCMAKE_BUILD_TYPE=RelWithDebInfo
${{ ( matrix.stdlib == 'libc++' && '-DCMAKE_CXX_FLAGS=-stdlib=libc++' ) || '' }}
- uses: ./.github/actions/run-tests
Expand Down
64 changes: 32 additions & 32 deletions .github/workflows/test_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,93 +89,93 @@
},
{
"os": "ubuntu-22.04",
"clang-version": 14,
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 11,
"tsan": false,
"shared": false,
"name" : "ubuntu-22.04, clang-14, libstdc++11, shared=false, tsan=false"
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=false, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 14,
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 11,
"tsan": false,
"shared": true,
"name" : "ubuntu-22.04, clang-14, libstdc++11, shared=true, tsan=false"
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=true, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 14,
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 12,
"tsan": false,
"libstdcxx-version": 11,
"tsan": true,
"shared": false,
"name" : "ubuntu-22.04, clang-14, libstdc++12, shared=false, tsan=false"
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=false, tsan=true"
},
{
"os": "ubuntu-22.04",
"clang-version": 14,
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 12,
"tsan": false,
"shared": true,
"name" : "ubuntu-22.04, clang-14, libstdc++12, shared=true, tsan=false"
"shared": false,
"name" : "ubuntu-22.04, clang-15, libstdcxx-12, shared=false, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 11,
"tsan": false,
"libstdcxx-version": 12,
"tsan": true,
"shared": false,
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=false, tsan=false"
"name" : "ubuntu-22.04, clang-15, libstdc++12, shared=false, tsan=true"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"stdlib": "libstdc++",
"libstdcxx-version": 11,
"libstdcxx-version": 12,
"tsan": false,
"shared": true,
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=true, tsan=false"
"name" : "ubuntu-22.04, clang-15, libstdcxx-12, shared=true, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"clang-version": 16,
"stdlib": "libstdc++",
"libstdcxx-version": 11,
"tsan": true,
"tsan": false,
"shared": false,
"name" : "ubuntu-22.04, clang-15, libstdc++11, shared=false, tsan=true"
"name" : "ubuntu-22.04, clang-16, libstdc++11, shared=false, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"clang-version": 16,
"stdlib": "libstdc++",
"libstdcxx-version": 12,
"libstdcxx-version": 11,
"tsan": false,
"shared": false,
"name" : "ubuntu-22.04, clang-15, libstdcxx-12, shared=false, tsan=false"
"shared": true,
"name" : "ubuntu-22.04, clang-16, libstdc++11, shared=true, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"clang-version": 16,
"stdlib": "libstdc++",
"libstdcxx-version": 12,
"tsan": true,
"tsan": false,
"shared": false,
"name" : "ubuntu-22.04, clang-15, libstdc++12, shared=false, tsan=true"
"name" : "ubuntu-22.04, clang-16, libstdc++12, shared=false, tsan=false"
},
{
"os": "ubuntu-22.04",
"clang-version": 15,
"clang-version": 16,
"stdlib": "libstdc++",
"libstdcxx-version": 12,
"tsan": false,
"shared": true,
"name" : "ubuntu-22.04, clang-15, libstdcxx-12, shared=true, tsan=false"
"name" : "ubuntu-22.04, clang-16, libstdc++12, shared=true, tsan=false"
},
{
"os": "ubuntu-22.04",
Expand Down Expand Up @@ -235,19 +235,19 @@
},
{
"os": "windows-2022",
"clang-version": 15,
"clang-version": 16,
"stdlib": "msvc-stl",
"tsan": false,
"shared": false,
"name" : "windows-2022, clang-15, msvc-stl, shared=false, tsan=false"
"name" : "windows-2022, clang-16, msvc-stl, shared=false, tsan=false"
},
{
"os": "windows-2022",
"clang-version": 15,
"clang-version": 16,
"stdlib": "msvc-stl",
"tsan": false,
"shared": true,
"name" : "windows-2022, clang-15, msvc-stl, shared=true, tsan=false"
"name" : "windows-2022, clang-16, msvc-stl, shared=true, tsan=false"
},
{
"os": "macos-12",
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(concurrencpp_sources
source/results/impl/result_state.cpp
source/results/impl/shared_result_state.cpp
source/runtime/runtime.cpp
source/threads/atomic_wait.cpp
source/threads/async_lock.cpp
source/threads/async_condition_variable.cpp
source/threads/thread.cpp
Expand Down Expand Up @@ -71,6 +72,7 @@ set(concurrencpp_headers
include/concurrencpp/runtime/constants.h
include/concurrencpp/runtime/runtime.h
include/concurrencpp/threads/constants.h
include/concurrencpp/threads/atomic_wait.h
include/concurrencpp/threads/async_lock.h
include/concurrencpp/threads/async_condition_variable.h
include/concurrencpp/threads/thread.h
Expand Down
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1808,20 +1808,6 @@ class scoped_async_lock {
Swaps the contents of *this and rhs.
*/
void swap(scoped_async_lock& rhs) noexcept;
/*
Empties *this and returns a pointer to the previously wrapped lock.
After a call to this method, *this doesn't wrap any lock.
The previously wrapped lock is not released,
it must be released by either unlocking it manually through the returned pointer or by
capturing the pointer with another scoped_async_lock which will take ownerwhip over it.
*/
async_lock* release() noexcept;
/*
Returns a pointer to the wrapped async_lock, or a null pointer if there is no wrapped async_lock.
*/
async_lock* mutex() const noexcept;
};
```
#### `async_lock` example:
Expand Down
2 changes: 1 addition & 1 deletion include/concurrencpp/executors/inline_executor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace concurrencpp {
}

public:
inline_executor() noexcept : executor(details::consts::k_inline_executor_name), m_abort(false) {}
inline_executor() : executor(details::consts::k_inline_executor_name), m_abort(false) {}

void enqueue(concurrencpp::task task) override {
throw_if_aborted();
Expand Down
18 changes: 13 additions & 5 deletions include/concurrencpp/results/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ namespace concurrencpp::details::consts {

inline const char* k_result_promise_set_result_error_msg = "concurrencpp::result_promise::set_result() - empty result_promise.";

inline const char* k_result_promise_set_exception_error_msg = "concurrencpp::result_promise::set_exception() - empty result_promise.";
inline const char* k_result_promise_set_exception_error_msg =
"concurrencpp::result_promise::set_exception() - empty result_promise.";

inline const char* k_result_promise_set_exception_null_exception_error_msg =
"concurrencpp::result_promise::set_exception() - exception pointer is null.";

inline const char* k_result_promise_set_from_function_error_msg = "concurrencpp::result_promise::set_from_function() - empty result_promise.";
inline const char* k_result_promise_set_from_function_error_msg =
"concurrencpp::result_promise::set_from_function() - empty result_promise.";

inline const char* k_result_promise_get_result_error_msg = "concurrencpp::result_promise::get_result() - empty result_promise.";

Expand Down Expand Up @@ -47,7 +49,11 @@ namespace concurrencpp::details::consts {
* when_xxx
*/

inline const char* k_make_exceptional_result_exception_null_error_msg = "concurrencpp::make_exception_result() - given exception_ptr is null.";
inline const char* k_make_exceptional_result_exception_null_error_msg =
"concurrencpp::make_exceptional_result() - given exception_ptr is null.";

inline const char* k_make_exceptional_lazy_result_exception_null_error_msg =
"concurrencpp::make_exceptional_lazy_result() - given exception_ptr is null.";

inline const char* k_when_all_empty_result_error_msg = "concurrencpp::when_all() - one of the result objects is empty.";

Expand All @@ -73,7 +79,8 @@ namespace concurrencpp::details::consts {

inline const char* k_shared_result_wait_until_error_msg = "concurrencpp::shared_result::wait_until() - result is empty.";

inline const char* k_shared_result_operator_co_await_error_msg = "concurrencpp::shared_result::operator co_await() - result is empty.";
inline const char* k_shared_result_operator_co_await_error_msg =
"concurrencpp::shared_result::operator co_await() - result is empty.";

inline const char* k_shared_result_resolve_error_msg = "concurrencpp::shared_result::resolve() - result is empty.";

Expand All @@ -83,7 +90,8 @@ namespace concurrencpp::details::consts {

inline const char* k_empty_lazy_result_status_err_msg = "concurrencpp::lazy_result::status - result is empty.";

inline const char* k_empty_lazy_result_operator_co_await_err_msg = "concurrencpp::lazy_result::operator co_await - result is empty.";
inline const char* k_empty_lazy_result_operator_co_await_err_msg =
"concurrencpp::lazy_result::operator co_await - result is empty.";

inline const char* k_empty_lazy_result_resolve_err_msg = "concurrencpp::lazy_result::resolve - result is empty.";

Expand Down
7 changes: 2 additions & 5 deletions include/concurrencpp/results/impl/consumer_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "concurrencpp/results/result_fwd_declarations.h"

#include <atomic>
#include <semaphore>

namespace concurrencpp::details {
class CRCPP_API await_via_functor {
Expand Down Expand Up @@ -45,11 +44,10 @@ namespace concurrencpp::details {
class CRCPP_API consumer_context {

private:
enum class consumer_status { idle, await, wait_for, when_any, shared };
enum class consumer_status { idle, await, when_any, shared };

union storage {
coroutine_handle<void> caller_handle;
std::shared_ptr<std::binary_semaphore> wait_for_ctx;
std::shared_ptr<when_any_context> when_any_ctx;
std::weak_ptr<shared_result_state_base> shared_ctx;

Expand All @@ -67,10 +65,9 @@ namespace concurrencpp::details {
~consumer_context() noexcept;

void clear() noexcept;
void resume_consumer(result_state_base& self) const;
void resume_consumer(result_state_base& self) const noexcept;

void set_await_handle(coroutine_handle<void> caller_handle) noexcept;
void set_wait_for_context(const std::shared_ptr<std::binary_semaphore>& wait_ctx) noexcept;
void set_when_any_context(const std::shared_ptr<when_any_context>& when_any_ctx) noexcept;
void set_shared_context(const std::shared_ptr<shared_result_state_base>& shared_ctx) noexcept;
};
Expand Down
Loading

0 comments on commit f59843a

Please sign in to comment.