diff --git a/include/cppcoro/async_auto_reset_event.hpp b/include/cppcoro/async_auto_reset_event.hpp index ce1f2d80..b74ae2b5 100644 --- a/include/cppcoro/async_auto_reset_event.hpp +++ b/include/cppcoro/async_auto_reset_event.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED #define CPPCORO_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED -#include +#include #include #include @@ -80,7 +80,7 @@ namespace cppcoro async_auto_reset_event_operation(const async_auto_reset_event_operation& other) noexcept; bool await_ready() const noexcept { return m_event == nullptr; } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -89,7 +89,7 @@ namespace cppcoro const async_auto_reset_event* m_event; async_auto_reset_event_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + cppcoro::coroutine_handle<> m_awaiter; std::atomic m_refCount; }; diff --git a/include/cppcoro/async_generator.hpp b/include/cppcoro/async_generator.hpp index 4c2140da..50403e76 100644 --- a/include/cppcoro/async_generator.hpp +++ b/include/cppcoro/async_generator.hpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include @@ -45,7 +45,7 @@ namespace cppcoro async_generator_promise_base(const async_generator_promise_base& other) = delete; async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete; - std::experimental::suspend_always initial_suspend() const noexcept + cppcoro::suspend_always initial_suspend() const noexcept { return {}; } @@ -89,7 +89,7 @@ namespace cppcoro std::exception_ptr m_exception; - std::experimental::coroutine_handle<> m_consumerCoroutine; + cppcoro::coroutine_handle<> m_consumerCoroutine; protected: @@ -100,7 +100,7 @@ namespace cppcoro { public: - async_generator_yield_operation(std::experimental::coroutine_handle<> consumer) noexcept + async_generator_yield_operation(cppcoro::coroutine_handle<> consumer) noexcept : m_consumer(consumer) {} @@ -109,8 +109,8 @@ namespace cppcoro return false; } - std::experimental::coroutine_handle<> - await_suspend([[maybe_unused]] std::experimental::coroutine_handle<> producer) noexcept + cppcoro::coroutine_handle<> + await_suspend([[maybe_unused]] cppcoro::coroutine_handle<> producer) noexcept { return m_consumer; } @@ -119,7 +119,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle<> m_consumer; + cppcoro::coroutine_handle<> m_consumer; }; @@ -145,7 +145,7 @@ namespace cppcoro async_generator_advance_operation( async_generator_promise_base& promise, - std::experimental::coroutine_handle<> producerCoroutine) noexcept + cppcoro::coroutine_handle<> producerCoroutine) noexcept : m_promise(std::addressof(promise)) , m_producerCoroutine(producerCoroutine) { @@ -155,8 +155,8 @@ namespace cppcoro bool await_ready() const noexcept { return false; } - std::experimental::coroutine_handle<> - await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept + cppcoro::coroutine_handle<> + await_suspend(cppcoro::coroutine_handle<> consumerCoroutine) noexcept { m_promise->m_consumerCoroutine = consumerCoroutine; return m_producerCoroutine; @@ -165,7 +165,7 @@ namespace cppcoro protected: async_generator_promise_base* m_promise; - std::experimental::coroutine_handle<> m_producerCoroutine; + cppcoro::coroutine_handle<> m_producerCoroutine; }; @@ -242,7 +242,7 @@ namespace cppcoro class async_generator_iterator final { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = cppcoro::coroutine_handle; public: @@ -307,7 +307,7 @@ namespace cppcoro class async_generator_begin_operation final : public async_generator_advance_operation { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = cppcoro::coroutine_handle; public: @@ -358,7 +358,7 @@ namespace cppcoro {} explicit async_generator(promise_type& promise) noexcept - : m_coroutine(std::experimental::coroutine_handle::from_promise(promise)) + : m_coroutine(cppcoro::coroutine_handle::from_promise(promise)) {} async_generator(async_generator&& other) noexcept @@ -408,7 +408,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; }; @@ -451,7 +451,7 @@ namespace cppcoro async_generator_promise_base(const async_generator_promise_base& other) = delete; async_generator_promise_base& operator=(const async_generator_promise_base& other) = delete; - std::experimental::suspend_always initial_suspend() const noexcept + cppcoro::suspend_always initial_suspend() const noexcept { return {}; } @@ -556,7 +556,7 @@ namespace cppcoro std::exception_ptr m_exception; - std::experimental::coroutine_handle<> m_consumerCoroutine; + cppcoro::coroutine_handle<> m_consumerCoroutine; protected: @@ -579,7 +579,7 @@ namespace cppcoro return m_initialState == state::value_not_ready_consumer_suspended; } - bool await_suspend(std::experimental::coroutine_handle<> producer) noexcept; + bool await_suspend(cppcoro::coroutine_handle<> producer) noexcept; void await_resume() noexcept {} @@ -625,7 +625,7 @@ namespace cppcoro } inline bool async_generator_yield_operation::await_suspend( - std::experimental::coroutine_handle<> producer) noexcept + cppcoro::coroutine_handle<> producer) noexcept { state currentState = m_initialState; if (currentState == state::value_not_ready_consumer_active) @@ -711,7 +711,7 @@ namespace cppcoro async_generator_advance_operation( async_generator_promise_base& promise, - std::experimental::coroutine_handle<> producerCoroutine) noexcept + cppcoro::coroutine_handle<> producerCoroutine) noexcept : m_promise(std::addressof(promise)) , m_producerCoroutine(producerCoroutine) { @@ -740,7 +740,7 @@ namespace cppcoro return m_initialState == state::value_ready_producer_suspended; } - bool await_suspend(std::experimental::coroutine_handle<> consumerCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> consumerCoroutine) noexcept { m_promise->m_consumerCoroutine = consumerCoroutine; @@ -791,7 +791,7 @@ namespace cppcoro protected: async_generator_promise_base* m_promise; - std::experimental::coroutine_handle<> m_producerCoroutine; + cppcoro::coroutine_handle<> m_producerCoroutine; private: @@ -872,7 +872,7 @@ namespace cppcoro class async_generator_iterator final { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = cppcoro::coroutine_handle; public: @@ -937,7 +937,7 @@ namespace cppcoro class async_generator_begin_operation final : public async_generator_advance_operation { using promise_type = async_generator_promise; - using handle_type = std::experimental::coroutine_handle; + using handle_type = cppcoro::coroutine_handle; public: @@ -988,7 +988,7 @@ namespace cppcoro {} explicit async_generator(promise_type& promise) noexcept - : m_coroutine(std::experimental::coroutine_handle::from_promise(promise)) + : m_coroutine(cppcoro::coroutine_handle::from_promise(promise)) {} async_generator(async_generator&& other) noexcept @@ -1041,7 +1041,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; }; diff --git a/include/cppcoro/async_manual_reset_event.hpp b/include/cppcoro/async_manual_reset_event.hpp index 5f20688e..fd582828 100644 --- a/include/cppcoro/async_manual_reset_event.hpp +++ b/include/cppcoro/async_manual_reset_event.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_ASYNC_MANUAL_RESET_EVENT_HPP_INCLUDED #define CPPCORO_ASYNC_MANUAL_RESET_EVENT_HPP_INCLUDED -#include +#include #include #include @@ -87,7 +87,7 @@ namespace cppcoro explicit async_manual_reset_event_operation(const async_manual_reset_event& event) noexcept; bool await_ready() const noexcept; - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -96,7 +96,7 @@ namespace cppcoro const async_manual_reset_event& m_event; async_manual_reset_event_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + cppcoro::coroutine_handle<> m_awaiter; }; } diff --git a/include/cppcoro/async_mutex.hpp b/include/cppcoro/async_mutex.hpp index cc193112..2f4fd61f 100644 --- a/include/cppcoro/async_mutex.hpp +++ b/include/cppcoro/async_mutex.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_ASYNC_MUTEX_HPP_INCLUDED #define CPPCORO_ASYNC_MUTEX_HPP_INCLUDED -#include +#include #include #include #include // for std::adopt_lock_t @@ -166,7 +166,7 @@ namespace cppcoro {} bool await_ready() const noexcept { return false; } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} protected: @@ -178,7 +178,7 @@ namespace cppcoro private: async_mutex_lock_operation* m_next; - std::experimental::coroutine_handle<> m_awaiter; + cppcoro::coroutine_handle<> m_awaiter; }; diff --git a/include/cppcoro/async_scope.hpp b/include/cppcoro/async_scope.hpp index c46b8c6e..6cad9774 100644 --- a/include/cppcoro/async_scope.hpp +++ b/include/cppcoro/async_scope.hpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -52,7 +52,7 @@ namespace cppcoro return m_scope->m_count.load(std::memory_order_acquire) == 0; } - bool await_suspend(std::experimental::coroutine_handle<> continuation) noexcept + bool await_suspend(cppcoro::coroutine_handle<> continuation) noexcept { m_scope->m_continuation = continuation; return m_scope->m_count.fetch_sub(1u, std::memory_order_acq_rel) > 1u; @@ -85,8 +85,8 @@ namespace cppcoro { struct promise_type { - std::experimental::suspend_never initial_suspend() { return {}; } - std::experimental::suspend_never final_suspend() { return {}; } + cppcoro::suspend_never initial_suspend() { return {}; } + cppcoro::suspend_never final_suspend() { return {}; } void unhandled_exception() { std::terminate(); } oneway_task get_return_object() { return {}; } void return_void() {} @@ -94,7 +94,7 @@ namespace cppcoro }; std::atomic m_count; - std::experimental::coroutine_handle<> m_continuation; + cppcoro::coroutine_handle<> m_continuation; }; } diff --git a/include/cppcoro/coroutine.hpp b/include/cppcoro/coroutine.hpp new file mode 100644 index 00000000..73c2e794 --- /dev/null +++ b/include/cppcoro/coroutine.hpp @@ -0,0 +1,32 @@ +#ifndef CPPCORO_COROUTINE_HPP_INCLUDED +#define CPPCORO_COROUTINE_HPP_INCLUDED + +#if __has_include() + +#include + +namespace cppcoro { + template + using coroutine_handle = std::coroutine_handle; + + using suspend_always = std::suspend_always; + using suspend_never = std::suspend_never; +} + +#elif __has_include() + +#include + +namespace cppcoro { + template + using coroutine_handle = std::experimental::coroutine_handle; + + using suspend_always = std::experimental::suspend_always; + using suspend_never = std::experimental::suspend_never; +} + +#else +#error Cppcoro requires a C++20 compiler with coroutine support +#endif + +#endif diff --git a/include/cppcoro/detail/is_awaiter.hpp b/include/cppcoro/detail/is_awaiter.hpp index 1538c8f3..c5781ce5 100644 --- a/include/cppcoro/detail/is_awaiter.hpp +++ b/include/cppcoro/detail/is_awaiter.hpp @@ -6,7 +6,7 @@ #define CPPCORO_DETAIL_IS_AWAITER_HPP_INCLUDED #include -#include +#include namespace cppcoro { @@ -18,7 +18,7 @@ namespace cppcoro {}; template - struct is_coroutine_handle> + struct is_coroutine_handle> : std::true_type {}; @@ -42,12 +42,12 @@ namespace cppcoro template struct is_awaiter().await_ready()), - decltype(std::declval().await_suspend(std::declval>())), + decltype(std::declval().await_suspend(std::declval>())), decltype(std::declval().await_resume())>> : std::conjunction< std::is_constructible().await_ready())>, detail::is_valid_await_suspend_return_value< - decltype(std::declval().await_suspend(std::declval>()))>> + decltype(std::declval().await_suspend(std::declval>()))>> {}; } } diff --git a/include/cppcoro/detail/sync_wait_task.hpp b/include/cppcoro/detail/sync_wait_task.hpp index f36b6f8f..2bf62116 100644 --- a/include/cppcoro/detail/sync_wait_task.hpp +++ b/include/cppcoro/detail/sync_wait_task.hpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -23,7 +23,7 @@ namespace cppcoro template class sync_wait_task_promise final { - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = cppcoro::coroutine_handle>; public: @@ -43,7 +43,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + cppcoro::suspend_always initial_suspend() noexcept { return{}; } @@ -88,7 +88,7 @@ namespace cppcoro bool await_ready() noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(cppcoro::coroutine_handle<>) noexcept {} sync_wait_task_promise& await_resume() noexcept { return *m_promise; @@ -139,7 +139,7 @@ namespace cppcoro template<> class sync_wait_task_promise { - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = cppcoro::coroutine_handle>; public: @@ -157,7 +157,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + cppcoro::suspend_always initial_suspend() noexcept { return{}; } @@ -210,7 +210,7 @@ namespace cppcoro using promise_type = sync_wait_task_promise; - using coroutine_handle_t = std::experimental::coroutine_handle; + using coroutine_handle_t = cppcoro::coroutine_handle; sync_wait_task(coroutine_handle_t coroutine) noexcept : m_coroutine(coroutine) diff --git a/include/cppcoro/detail/when_all_counter.hpp b/include/cppcoro/detail/when_all_counter.hpp index 5ed8d888..0a38e426 100644 --- a/include/cppcoro/detail/when_all_counter.hpp +++ b/include/cppcoro/detail/when_all_counter.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_DETAIL_WHEN_ALL_COUNTER_HPP_INCLUDED #define CPPCORO_DETAIL_WHEN_ALL_COUNTER_HPP_INCLUDED -#include +#include #include #include @@ -29,7 +29,7 @@ namespace cppcoro return static_cast(m_awaitingCoroutine); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; return m_count.fetch_sub(1, std::memory_order_acq_rel) > 1; @@ -46,7 +46,7 @@ namespace cppcoro protected: std::atomic m_count; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; }; } diff --git a/include/cppcoro/detail/when_all_ready_awaitable.hpp b/include/cppcoro/detail/when_all_ready_awaitable.hpp index 2fe80c68..54a52635 100644 --- a/include/cppcoro/detail/when_all_ready_awaitable.hpp +++ b/include/cppcoro/detail/when_all_ready_awaitable.hpp @@ -7,7 +7,7 @@ #include -#include +#include #include namespace cppcoro @@ -26,7 +26,7 @@ namespace cppcoro explicit constexpr when_all_ready_awaitable(std::tuple<>) noexcept {} constexpr bool await_ready() const noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(cppcoro::coroutine_handle<>) noexcept {} std::tuple<> await_resume() const noexcept { return {}; } }; @@ -66,7 +66,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -98,7 +98,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -124,7 +124,7 @@ namespace cppcoro return m_counter.is_ready(); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { start_tasks(std::make_integer_sequence{}); return m_counter.try_await(awaitingCoroutine); @@ -177,7 +177,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -212,7 +212,7 @@ namespace cppcoro return m_awaitable.is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_awaitable.try_await(awaitingCoroutine); } @@ -238,7 +238,7 @@ namespace cppcoro return m_counter.is_ready(); } - bool try_await(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool try_await(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { for (auto&& task : m_tasks) { diff --git a/include/cppcoro/detail/when_all_task.hpp b/include/cppcoro/detail/when_all_task.hpp index abaff33b..a9a6f454 100644 --- a/include/cppcoro/detail/when_all_task.hpp +++ b/include/cppcoro/detail/when_all_task.hpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include namespace cppcoro @@ -28,7 +28,7 @@ namespace cppcoro { public: - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = cppcoro::coroutine_handle>; when_all_task_promise() noexcept {} @@ -38,7 +38,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + cppcoro::suspend_always initial_suspend() noexcept { return{}; } @@ -97,7 +97,7 @@ namespace cppcoro bool await_ready() noexcept { return true; } - void await_suspend(std::experimental::coroutine_handle<>) noexcept {} + void await_suspend(cppcoro::coroutine_handle<>) noexcept {} when_all_task_promise& await_resume() noexcept { return *m_promise; @@ -155,7 +155,7 @@ namespace cppcoro { public: - using coroutine_handle_t = std::experimental::coroutine_handle>; + using coroutine_handle_t = cppcoro::coroutine_handle>; when_all_task_promise() noexcept {} @@ -165,7 +165,7 @@ namespace cppcoro return coroutine_handle_t::from_promise(*this); } - std::experimental::suspend_always initial_suspend() noexcept + cppcoro::suspend_always initial_suspend() noexcept { return{}; } diff --git a/include/cppcoro/detail/win32_overlapped_operation.hpp b/include/cppcoro/detail/win32_overlapped_operation.hpp index b921aa15..82cc04cf 100644 --- a/include/cppcoro/detail/win32_overlapped_operation.hpp +++ b/include/cppcoro/detail/win32_overlapped_operation.hpp @@ -13,7 +13,7 @@ #include #include -#include +#include #include namespace cppcoro @@ -100,7 +100,7 @@ namespace cppcoro bool await_ready() const noexcept { return false; } CPPCORO_NOINLINE - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) { static_assert(std::is_base_of_v); @@ -127,7 +127,7 @@ namespace cppcoro operation->m_awaitingCoroutine.resume(); } - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; }; @@ -186,7 +186,7 @@ namespace cppcoro } CPPCORO_NOINLINE - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) { static_assert(std::is_base_of_v); @@ -367,7 +367,7 @@ namespace cppcoro std::atomic m_state; cppcoro::cancellation_token m_cancellationToken; std::optional m_cancellationCallback; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; }; } diff --git a/include/cppcoro/file.hpp b/include/cppcoro/file.hpp index aa507537..af9444e0 100644 --- a/include/cppcoro/file.hpp +++ b/include/cppcoro/file.hpp @@ -40,7 +40,7 @@ namespace cppcoro static detail::win32::safe_handle open( detail::win32::dword_t fileAccess, io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode); diff --git a/include/cppcoro/file_read_operation.hpp b/include/cppcoro/file_read_operation.hpp index 509d4547..2566acf7 100644 --- a/include/cppcoro/file_read_operation.hpp +++ b/include/cppcoro/file_read_operation.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include #if CPPCORO_OS_WINNT # include diff --git a/include/cppcoro/file_write_operation.hpp b/include/cppcoro/file_write_operation.hpp index afc30d55..ffed1fc9 100644 --- a/include/cppcoro/file_write_operation.hpp +++ b/include/cppcoro/file_write_operation.hpp @@ -11,7 +11,7 @@ #include #include -#include +#include #if CPPCORO_OS_WINNT # include diff --git a/include/cppcoro/fmap.hpp b/include/cppcoro/fmap.hpp index a339493c..781b16d1 100644 --- a/include/cppcoro/fmap.hpp +++ b/include/cppcoro/fmap.hpp @@ -38,7 +38,7 @@ namespace cppcoro } template - decltype(auto) await_suspend(std::experimental::coroutine_handle coro) + decltype(auto) await_suspend(cppcoro::coroutine_handle coro) noexcept(noexcept(static_cast(m_awaiter).await_suspend(std::move(coro)))) { return static_cast(m_awaiter).await_suspend(std::move(coro)); diff --git a/include/cppcoro/generator.hpp b/include/cppcoro/generator.hpp index d39d7e7c..d0a7e84f 100644 --- a/include/cppcoro/generator.hpp +++ b/include/cppcoro/generator.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_GENERATOR_HPP_INCLUDED #define CPPCORO_GENERATOR_HPP_INCLUDED -#include +#include #include #include #include @@ -32,19 +32,19 @@ namespace cppcoro generator get_return_object() noexcept; - constexpr std::experimental::suspend_always initial_suspend() const { return {}; } - constexpr std::experimental::suspend_always final_suspend() const { return {}; } + constexpr cppcoro::suspend_always initial_suspend() const { return {}; } + constexpr cppcoro::suspend_always final_suspend() const { return {}; } template< typename U = T, std::enable_if_t::value, int> = 0> - std::experimental::suspend_always yield_value(std::remove_reference_t& value) noexcept + cppcoro::suspend_always yield_value(std::remove_reference_t& value) noexcept { m_value = std::addressof(value); return {}; } - std::experimental::suspend_always yield_value(std::remove_reference_t&& value) noexcept + cppcoro::suspend_always yield_value(std::remove_reference_t&& value) noexcept { m_value = std::addressof(value); return {}; @@ -66,7 +66,7 @@ namespace cppcoro // Don't allow any use of 'co_await' inside the generator coroutine. template - std::experimental::suspend_never await_transform(U&& value) = delete; + cppcoro::suspend_never await_transform(U&& value) = delete; void rethrow_if_exception() { @@ -88,7 +88,7 @@ namespace cppcoro template class generator_iterator { - using coroutine_handle = std::experimental::coroutine_handle>; + using coroutine_handle = cppcoro::coroutine_handle>; public: @@ -223,11 +223,11 @@ namespace cppcoro friend class detail::generator_promise; - explicit generator(std::experimental::coroutine_handle coroutine) noexcept + explicit generator(cppcoro::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; }; @@ -242,7 +242,7 @@ namespace cppcoro template generator generator_promise::get_return_object() noexcept { - using coroutine_handle = std::experimental::coroutine_handle>; + using coroutine_handle = cppcoro::coroutine_handle>; return generator{ coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/inline_scheduler.hpp b/include/cppcoro/inline_scheduler.hpp index bd439f37..a0862a04 100644 --- a/include/cppcoro/inline_scheduler.hpp +++ b/include/cppcoro/inline_scheduler.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_INLINE_SCHEDULER_HPP_INCLUDED #define CPPCORO_INLINE_SCHEDULER_HPP_INCLUDED -#include +#include namespace cppcoro { @@ -15,7 +15,7 @@ namespace cppcoro inline_scheduler() noexcept = default; - std::experimental::suspend_never schedule() const noexcept + cppcoro::suspend_never schedule() const noexcept { return {}; } diff --git a/include/cppcoro/io_service.hpp b/include/cppcoro/io_service.hpp index 6d2a3464..b6b4dbdc 100644 --- a/include/cppcoro/io_service.hpp +++ b/include/cppcoro/io_service.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace cppcoro { @@ -192,7 +192,7 @@ namespace cppcoro {} bool await_ready() const noexcept { return false; } - void await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept; + void await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept; void await_resume() const noexcept {} private: @@ -201,7 +201,7 @@ namespace cppcoro friend class io_service::timed_schedule_operation; io_service& m_service; - std::experimental::coroutine_handle<> m_awaiter; + cppcoro::coroutine_handle<> m_awaiter; schedule_operation* m_next; }; @@ -224,7 +224,7 @@ namespace cppcoro timed_schedule_operation& operator=(const timed_schedule_operation& other) = delete; bool await_ready() const noexcept; - void await_suspend(std::experimental::coroutine_handle<> awaiter); + void await_suspend(cppcoro::coroutine_handle<> awaiter); void await_resume(); private: diff --git a/include/cppcoro/multi_producer_sequencer.hpp b/include/cppcoro/multi_producer_sequencer.hpp index 72589c3d..c6565948 100644 --- a/include/cppcoro/multi_producer_sequencer.hpp +++ b/include/cppcoro/multi_producer_sequencer.hpp @@ -194,7 +194,7 @@ namespace cppcoro return m_barrierWait.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_barrierWait.await_suspend(awaitingCoroutine); } @@ -273,7 +273,7 @@ namespace cppcoro return m_waitOp.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_waitOp.await_suspend(awaitingCoroutine); } @@ -347,7 +347,7 @@ namespace cppcoro return !TRAITS::precedes(m_lastKnownPublished, m_targetSequence); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; @@ -384,7 +384,7 @@ namespace cppcoro SEQUENCE m_targetSequence; SEQUENCE m_lastKnownPublished; multi_producer_sequencer_wait_operation_base* m_next; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; std::atomic m_readyToResume; }; diff --git a/include/cppcoro/read_only_file.hpp b/include/cppcoro/read_only_file.hpp index a836fbc3..3dbd0a53 100644 --- a/include/cppcoro/read_only_file.hpp +++ b/include/cppcoro/read_only_file.hpp @@ -43,7 +43,7 @@ namespace cppcoro [[nodiscard]] static read_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_share_mode shareMode = file_share_mode::read, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/include/cppcoro/read_write_file.hpp b/include/cppcoro/read_write_file.hpp index f58bea5c..ca955ca8 100644 --- a/include/cppcoro/read_write_file.hpp +++ b/include/cppcoro/read_write_file.hpp @@ -49,7 +49,7 @@ namespace cppcoro [[nodiscard]] static read_write_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/include/cppcoro/recursive_generator.hpp b/include/cppcoro/recursive_generator.hpp index 07e4f726..65af46c0 100644 --- a/include/cppcoro/recursive_generator.hpp +++ b/include/cppcoro/recursive_generator.hpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include #include @@ -39,12 +39,12 @@ namespace cppcoro return recursive_generator{ *this }; } - std::experimental::suspend_always initial_suspend() noexcept + cppcoro::suspend_always initial_suspend() noexcept { return {}; } - std::experimental::suspend_always final_suspend() noexcept + cppcoro::suspend_always final_suspend() noexcept { return {}; } @@ -56,13 +56,13 @@ namespace cppcoro void return_void() noexcept {} - std::experimental::suspend_always yield_value(T& value) noexcept + cppcoro::suspend_always yield_value(T& value) noexcept { m_value = std::addressof(value); return {}; } - std::experimental::suspend_always yield_value(T&& value) noexcept + cppcoro::suspend_always yield_value(T&& value) noexcept { m_value = std::addressof(value); return {}; @@ -87,7 +87,7 @@ namespace cppcoro return this->m_childPromise == nullptr; } - void await_suspend(std::experimental::coroutine_handle) noexcept + void await_suspend(cppcoro::coroutine_handle) noexcept {} void await_resume() @@ -122,11 +122,11 @@ namespace cppcoro // Don't allow any use of 'co_await' inside the recursive_generator coroutine. template - std::experimental::suspend_never await_transform(U&& value) = delete; + cppcoro::suspend_never await_transform(U&& value) = delete; void destroy() noexcept { - std::experimental::coroutine_handle::from_promise(*this).destroy(); + cppcoro::coroutine_handle::from_promise(*this).destroy(); } void throw_if_exception() @@ -139,7 +139,7 @@ namespace cppcoro bool is_complete() noexcept { - return std::experimental::coroutine_handle::from_promise(*this).done(); + return cppcoro::coroutine_handle::from_promise(*this).done(); } T& value() noexcept @@ -167,7 +167,7 @@ namespace cppcoro void resume() noexcept { - std::experimental::coroutine_handle::from_promise(*this).resume(); + cppcoro::coroutine_handle::from_promise(*this).resume(); } std::add_pointer_t m_value; diff --git a/include/cppcoro/round_robin_scheduler.hpp b/include/cppcoro/round_robin_scheduler.hpp index 6749c61d..cd154052 100644 --- a/include/cppcoro/round_robin_scheduler.hpp +++ b/include/cppcoro/round_robin_scheduler.hpp @@ -7,7 +7,7 @@ #include -#include +#include #include #include #include @@ -44,8 +44,8 @@ namespace cppcoro return false; } - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + cppcoro::coroutine_handle<> await_suspend( + cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_scheduler.exchange_next(awaitingCoroutine); } @@ -61,7 +61,7 @@ namespace cppcoro public: round_robin_scheduler() noexcept : m_index(0) - , m_noop(std::experimental::noop_coroutine()) + , m_noop(cppcoro::noop_coroutine()) { for (size_t i = 0; i < N - 1; ++i) { @@ -104,8 +104,8 @@ namespace cppcoro private: - std::experimental::coroutine_handle exchange_next( - std::experimental::coroutine_handle<> coroutine) noexcept + cppcoro::coroutine_handle exchange_next( + cppcoro::coroutine_handle<> coroutine) noexcept { auto coroutineToResume = std::exchange( m_scheduler.m_coroutines[m_scheduler.m_index], @@ -115,8 +115,8 @@ namespace cppcoro } size_t m_index; - const std::experimental::coroutine_handle<> m_noop; - std::array, N - 1> m_coroutines; + const cppcoro::coroutine_handle<> m_noop; + std::array, N - 1> m_coroutines; }; #endif } diff --git a/include/cppcoro/sequence_barrier.hpp b/include/cppcoro/sequence_barrier.hpp index d23a5c09..e1f0eb8e 100644 --- a/include/cppcoro/sequence_barrier.hpp +++ b/include/cppcoro/sequence_barrier.hpp @@ -15,7 +15,7 @@ #include #include #include -#include +#include namespace cppcoro { @@ -161,7 +161,7 @@ namespace cppcoro return !TRAITS::precedes(m_lastKnownPublished, m_targetSequence); } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; m_barrier.add_awaiter(this); @@ -192,7 +192,7 @@ namespace cppcoro const SEQUENCE m_targetSequence; SEQUENCE m_lastKnownPublished; sequence_barrier_wait_operation_base* m_next; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; std::atomic m_readyToResume; }; diff --git a/include/cppcoro/shared_task.hpp b/include/cppcoro/shared_task.hpp index 797ba30a..f4478295 100644 --- a/include/cppcoro/shared_task.hpp +++ b/include/cppcoro/shared_task.hpp @@ -17,7 +17,7 @@ #include #include -#include +#include namespace cppcoro { @@ -28,7 +28,7 @@ namespace cppcoro { struct shared_task_waiter { - std::experimental::coroutine_handle<> m_continuation; + cppcoro::coroutine_handle<> m_continuation; shared_task_waiter* m_next; }; @@ -41,7 +41,7 @@ namespace cppcoro bool await_ready() const noexcept { return false; } template - void await_suspend(std::experimental::coroutine_handle h) noexcept + void await_suspend(cppcoro::coroutine_handle h) noexcept { shared_task_promise_base& promise = h.promise(); @@ -79,7 +79,7 @@ namespace cppcoro , m_exception(nullptr) {} - std::experimental::suspend_always initial_suspend() noexcept { return {}; } + cppcoro::suspend_always initial_suspend() noexcept { return {}; } final_awaiter final_suspend() noexcept { return {}; } void unhandled_exception() noexcept @@ -124,7 +124,7 @@ namespace cppcoro /// waiter->m_coroutine will be resumed when the task completes. /// false if the coroutine was already completed and the awaiting /// coroutine can continue without suspending. - bool try_await(shared_task_waiter* waiter, std::experimental::coroutine_handle<> coroutine) + bool try_await(shared_task_waiter* waiter, cppcoro::coroutine_handle<> coroutine) { void* const valueReadyValue = this; void* const notStartedValue = &this->m_waiters; @@ -304,10 +304,10 @@ namespace cppcoro struct awaitable_base { - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; detail::shared_task_waiter m_waiter; - awaitable_base(std::experimental::coroutine_handle coroutine) noexcept + awaitable_base(cppcoro::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} @@ -316,7 +316,7 @@ namespace cppcoro return !m_coroutine || m_coroutine.promise().is_ready(); } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept { m_waiter.m_continuation = awaiter; return m_coroutine.promise().try_await(&m_waiter, m_coroutine); @@ -329,7 +329,7 @@ namespace cppcoro : m_coroutine(nullptr) {} - explicit shared_task(std::experimental::coroutine_handle coroutine) + explicit shared_task(cppcoro::coroutine_handle coroutine) : m_coroutine(coroutine) { // Don't increment the ref-count here since it has already been @@ -452,7 +452,7 @@ namespace cppcoro } } - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; }; @@ -480,7 +480,7 @@ namespace cppcoro shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + cppcoro::coroutine_handle::from_promise(*this) }; } @@ -488,14 +488,14 @@ namespace cppcoro shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + cppcoro::coroutine_handle::from_promise(*this) }; } inline shared_task shared_task_promise::get_return_object() noexcept { return shared_task{ - std::experimental::coroutine_handle::from_promise(*this) + cppcoro::coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/single_consumer_async_auto_reset_event.hpp b/include/cppcoro/single_consumer_async_auto_reset_event.hpp index 821dbe73..56d8a9eb 100644 --- a/include/cppcoro/single_consumer_async_auto_reset_event.hpp +++ b/include/cppcoro/single_consumer_async_auto_reset_event.hpp @@ -5,7 +5,7 @@ #ifndef CPPCORO_SINGLE_CONSUMER_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED #define CPPCORO_SINGLE_CONSUMER_ASYNC_AUTO_RESET_EVENT_HPP_INCLUDED -#include +#include #include #include #include @@ -26,7 +26,7 @@ namespace cppcoro if (oldValue != nullptr && oldValue != this) { // There was a waiting coroutine that we now need to resume. - auto handle = *static_cast*>(oldValue); + auto handle = *static_cast*>(oldValue); // We also need to transition the state back to 'not set' before // resuming the coroutine. This operation needs to be 'acquire' @@ -54,7 +54,7 @@ namespace cppcoro bool await_ready() const noexcept { return false; } - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; @@ -82,7 +82,7 @@ namespace cppcoro private: const single_consumer_async_auto_reset_event& m_event; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; }; return awaiter{ *this }; diff --git a/include/cppcoro/single_consumer_event.hpp b/include/cppcoro/single_consumer_event.hpp index 167311c4..983c5ea8 100644 --- a/include/cppcoro/single_consumer_event.hpp +++ b/include/cppcoro/single_consumer_event.hpp @@ -6,7 +6,7 @@ #define CPPCORO_SINGLE_CONSUMER_EVENT_HPP_INCLUDED #include -#include +#include namespace cppcoro { @@ -84,7 +84,7 @@ namespace cppcoro return m_event.is_set(); } - bool await_suspend(std::experimental::coroutine_handle<> awaiter) + bool await_suspend(cppcoro::coroutine_handle<> awaiter) { m_event.m_awaiter = awaiter; @@ -120,7 +120,7 @@ namespace cppcoro // by encoding 'not_set' as 0 (nullptr), 'set' as 1 and // 'not_set_consumer_waiting' as a coroutine handle pointer. std::atomic m_state; - std::experimental::coroutine_handle<> m_awaiter; + cppcoro::coroutine_handle<> m_awaiter; }; } diff --git a/include/cppcoro/single_producer_sequencer.hpp b/include/cppcoro/single_producer_sequencer.hpp index d0333111..77e8d580 100644 --- a/include/cppcoro/single_producer_sequencer.hpp +++ b/include/cppcoro/single_producer_sequencer.hpp @@ -160,7 +160,7 @@ namespace cppcoro return m_consumerWaitOperation.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_consumerWaitOperation.await_suspend(awaitingCoroutine); } @@ -199,7 +199,7 @@ namespace cppcoro return m_consumerWaitOperation.await_ready(); } - auto await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + auto await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { return m_consumerWaitOperation.await_suspend(awaitingCoroutine); } diff --git a/include/cppcoro/static_thread_pool.hpp b/include/cppcoro/static_thread_pool.hpp index 95ef3c50..07a20788 100644 --- a/include/cppcoro/static_thread_pool.hpp +++ b/include/cppcoro/static_thread_pool.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace cppcoro { @@ -38,7 +38,7 @@ namespace cppcoro schedule_operation(static_thread_pool* tp) noexcept : m_threadPool(tp) {} bool await_ready() noexcept { return false; } - void await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept; + void await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept; void await_resume() noexcept {} private: @@ -46,7 +46,7 @@ namespace cppcoro friend class static_thread_pool; static_thread_pool* m_threadPool; - std::experimental::coroutine_handle<> m_awaitingCoroutine; + cppcoro::coroutine_handle<> m_awaitingCoroutine; schedule_operation* m_next; }; diff --git a/include/cppcoro/task.hpp b/include/cppcoro/task.hpp index 3bff404f..a0b5c39a 100644 --- a/include/cppcoro/task.hpp +++ b/include/cppcoro/task.hpp @@ -18,7 +18,7 @@ #include #include -#include +#include namespace cppcoro { @@ -36,8 +36,8 @@ namespace cppcoro #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER template - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle coro) noexcept + cppcoro::coroutine_handle<> await_suspend( + cppcoro::coroutine_handle coro) noexcept { return coro.promise().m_continuation; } @@ -49,7 +49,7 @@ namespace cppcoro // were crashing under x86 optimised builds. template CPPCORO_NOINLINE - void await_suspend(std::experimental::coroutine_handle coroutine) + void await_suspend(cppcoro::coroutine_handle coroutine) { task_promise_base& promise = coroutine.promise(); @@ -79,7 +79,7 @@ namespace cppcoro auto initial_suspend() noexcept { - return std::experimental::suspend_always{}; + return cppcoro::suspend_always{}; } auto final_suspend() noexcept @@ -88,12 +88,12 @@ namespace cppcoro } #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER - void set_continuation(std::experimental::coroutine_handle<> continuation) noexcept + void set_continuation(cppcoro::coroutine_handle<> continuation) noexcept { m_continuation = continuation; } #else - bool try_set_continuation(std::experimental::coroutine_handle<> continuation) + bool try_set_continuation(cppcoro::coroutine_handle<> continuation) { m_continuation = continuation; return !m_state.exchange(true, std::memory_order_acq_rel); @@ -102,7 +102,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle<> m_continuation; + cppcoro::coroutine_handle<> m_continuation; #if !CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER // Initially false. Set to true when either a continuation is registered @@ -292,9 +292,9 @@ namespace cppcoro struct awaitable_base { - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; - awaitable_base(std::experimental::coroutine_handle coroutine) noexcept + awaitable_base(cppcoro::coroutine_handle coroutine) noexcept : m_coroutine(coroutine) {} @@ -304,14 +304,14 @@ namespace cppcoro } #if CPPCORO_COMPILER_SUPPORTS_SYMMETRIC_TRANSFER - std::experimental::coroutine_handle<> await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + cppcoro::coroutine_handle<> await_suspend( + cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_coroutine.promise().set_continuation(awaitingCoroutine); return m_coroutine; } #else - bool await_suspend(std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + bool await_suspend(cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { // NOTE: We are using the bool-returning version of await_suspend() here // to work around a potential stack-overflow issue if a coroutine @@ -341,7 +341,7 @@ namespace cppcoro : m_coroutine(nullptr) {} - explicit task(std::experimental::coroutine_handle coroutine) + explicit task(cppcoro::coroutine_handle coroutine) : m_coroutine(coroutine) {} @@ -446,7 +446,7 @@ namespace cppcoro private: - std::experimental::coroutine_handle m_coroutine; + cppcoro::coroutine_handle m_coroutine; }; @@ -455,18 +455,18 @@ namespace cppcoro template task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ cppcoro::coroutine_handle::from_promise(*this) }; } inline task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ cppcoro::coroutine_handle::from_promise(*this) }; } template task task_promise::get_return_object() noexcept { - return task{ std::experimental::coroutine_handle::from_promise(*this) }; + return task{ cppcoro::coroutine_handle::from_promise(*this) }; } } diff --git a/include/cppcoro/write_only_file.hpp b/include/cppcoro/write_only_file.hpp index d3bf627a..773202ba 100644 --- a/include/cppcoro/write_only_file.hpp +++ b/include/cppcoro/write_only_file.hpp @@ -48,7 +48,7 @@ namespace cppcoro [[nodiscard]] static write_only_file open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode = file_open_mode::create_or_open, file_share_mode shareMode = file_share_mode::none, file_buffering_mode bufferingMode = file_buffering_mode::default_); diff --git a/lib/async_auto_reset_event.cpp b/lib/async_auto_reset_event.cpp index 96a2ac98..fa0bb733 100644 --- a/lib/async_auto_reset_event.cpp +++ b/lib/async_auto_reset_event.cpp @@ -241,7 +241,7 @@ cppcoro::async_auto_reset_event_operation::async_auto_reset_event_operation( {} bool cppcoro::async_auto_reset_event_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + cppcoro::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/async_manual_reset_event.cpp b/lib/async_manual_reset_event.cpp index 62eebdb3..f663b00a 100644 --- a/lib/async_manual_reset_event.cpp +++ b/lib/async_manual_reset_event.cpp @@ -72,7 +72,7 @@ bool cppcoro::async_manual_reset_event_operation::await_ready() const noexcept } bool cppcoro::async_manual_reset_event_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + cppcoro::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/async_mutex.cpp b/lib/async_mutex.cpp index d426d600..f713c939 100644 --- a/lib/async_mutex.cpp +++ b/lib/async_mutex.cpp @@ -85,7 +85,7 @@ void cppcoro::async_mutex::unlock() waitersHead->m_awaiter.resume(); } -bool cppcoro::async_mutex_lock_operation::await_suspend(std::experimental::coroutine_handle<> awaiter) noexcept +bool cppcoro::async_mutex_lock_operation::await_suspend(cppcoro::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; diff --git a/lib/file.cpp b/lib/file.cpp index 3583217f..0e15585c 100644 --- a/lib/file.cpp +++ b/lib/file.cpp @@ -47,7 +47,7 @@ cppcoro::file::file(detail::win32::safe_handle&& fileHandle) noexcept cppcoro::detail::win32::safe_handle cppcoro::file::open( detail::win32::dword_t fileAccess, io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/lib/io_service.cpp b/lib/io_service.cpp index 393c3ad9..551c2800 100644 --- a/lib/io_service.cpp +++ b/lib/io_service.cpp @@ -642,7 +642,7 @@ bool cppcoro::io_service::try_process_one_event(bool waitForEvent) { // This was a coroutine scheduled via a call to // io_service::schedule(). - std::experimental::coroutine_handle<>::from_address( + cppcoro::coroutine_handle<>::from_address( reinterpret_cast(completionKey)).resume(); return true; } @@ -911,7 +911,7 @@ void cppcoro::io_service::timer_thread_state::wake_up_timer_thread() noexcept } void cppcoro::io_service::schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) noexcept + cppcoro::coroutine_handle<> awaiter) noexcept { m_awaiter = awaiter; m_service.schedule_impl(this); @@ -947,7 +947,7 @@ bool cppcoro::io_service::timed_schedule_operation::await_ready() const noexcept } void cppcoro::io_service::timed_schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaiter) + cppcoro::coroutine_handle<> awaiter) { m_scheduleOperation.m_awaiter = awaiter; diff --git a/lib/read_only_file.cpp b/lib/read_only_file.cpp index 614aa48a..b278365c 100644 --- a/lib/read_only_file.cpp +++ b/lib/read_only_file.cpp @@ -13,7 +13,7 @@ cppcoro::read_only_file cppcoro::read_only_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_share_mode shareMode, file_buffering_mode bufferingMode) { diff --git a/lib/read_write_file.cpp b/lib/read_write_file.cpp index 231e6790..13838ea3 100644 --- a/lib/read_write_file.cpp +++ b/lib/read_write_file.cpp @@ -13,7 +13,7 @@ cppcoro::read_write_file cppcoro::read_write_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/lib/static_thread_pool.cpp b/lib/static_thread_pool.cpp index 36c39ce9..7becbbdb 100644 --- a/lib/static_thread_pool.cpp +++ b/lib/static_thread_pool.cpp @@ -319,7 +319,7 @@ namespace cppcoro }; void static_thread_pool::schedule_operation::await_suspend( - std::experimental::coroutine_handle<> awaitingCoroutine) noexcept + cppcoro::coroutine_handle<> awaitingCoroutine) noexcept { m_awaitingCoroutine = awaitingCoroutine; m_threadPool->schedule_impl(this); diff --git a/lib/write_only_file.cpp b/lib/write_only_file.cpp index 4c91bddf..0ed46fc4 100644 --- a/lib/write_only_file.cpp +++ b/lib/write_only_file.cpp @@ -13,7 +13,7 @@ cppcoro::write_only_file cppcoro::write_only_file::open( io_service& ioService, - const std::experimental::filesystem::path& path, + const cppcoro::filesystem::path& path, file_open_mode openMode, file_share_mode shareMode, file_buffering_mode bufferingMode) diff --git a/test/file_tests.cpp b/test/file_tests.cpp index 89742b8f..c160fe8e 100644 --- a/test/file_tests.cpp +++ b/test/file_tests.cpp @@ -24,7 +24,7 @@ TEST_SUITE_BEGIN("file"); -namespace fs = std::experimental::filesystem; +namespace fs = cppcoro::filesystem; namespace { @@ -60,14 +60,14 @@ namespace fs::remove_all(m_path); } - const std::experimental::filesystem::path& temp_dir() + const cppcoro::filesystem::path& temp_dir() { return m_path; } private: - std::experimental::filesystem::path m_path; + cppcoro::filesystem::path m_path; }; diff --git a/test/static_thread_pool_tests.cpp b/test/static_thread_pool_tests.cpp index ce93299d..fad633a3 100644 --- a/test/static_thread_pool_tests.cpp +++ b/test/static_thread_pool_tests.cpp @@ -132,7 +132,7 @@ TEST_CASE("launch sub-task with many sub-tasks") struct fork_join_operation { std::atomic m_count; - std::experimental::coroutine_handle<> m_coro; + cppcoro::coroutine_handle<> m_coro; fork_join_operation() : m_count(1) {} @@ -151,7 +151,7 @@ struct fork_join_operation bool await_ready() noexcept { return m_count.load(std::memory_order_acquire) == 1; } - bool await_suspend(std::experimental::coroutine_handle<> coro) noexcept + bool await_suspend(cppcoro::coroutine_handle<> coro) noexcept { m_coro = coro; return m_count.fetch_sub(1, std::memory_order_acq_rel) != 1; @@ -187,7 +187,7 @@ cppcoro::task for_each_async(SCHEDULER& scheduler, RANGE& range, FUNC func bool await_ready() noexcept { return false; } CPPCORO_NOINLINE - void await_suspend(std::experimental::coroutine_handle<> coro) noexcept + void await_suspend(cppcoro::coroutine_handle<> coro) noexcept { fork_join_operation& forkJoin = m_forkJoin; FUNC& func = m_func;