diff options
Diffstat (limited to 'include/llfio')
-rw-r--r-- | include/llfio/revision.hpp | 6 | ||||
-rw-r--r-- | include/llfio/v2.0/async_file_handle.hpp | 4 | ||||
-rw-r--r-- | include/llfio/v2.0/detail/impl/posix/directory_handle.ipp | 2 | ||||
-rw-r--r-- | include/llfio/v2.0/io_service.hpp | 28 | ||||
-rw-r--r-- | include/llfio/v2.0/status_code.hpp | 26 |
5 files changed, 34 insertions, 32 deletions
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp index 311d81b9..3eece543 100644 --- a/include/llfio/revision.hpp +++ b/include/llfio/revision.hpp @@ -1,4 +1,4 @@ // Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time -#define LLFIO_PREVIOUS_COMMIT_REF 7b5a2b5fa56cd53959e573a4750e09fe76030284 -#define LLFIO_PREVIOUS_COMMIT_DATE "2019-09-25 17:14:32 +00:00" -#define LLFIO_PREVIOUS_COMMIT_UNIQUE 7b5a2b5f +#define LLFIO_PREVIOUS_COMMIT_REF 1849f4e63413ea6f79ad50f18fba4c91bf7b28dd +#define LLFIO_PREVIOUS_COMMIT_DATE "2019-10-04 14:20:39 +00:00" +#define LLFIO_PREVIOUS_COMMIT_UNIQUE 1849f4e6 diff --git a/include/llfio/v2.0/async_file_handle.hpp b/include/llfio/v2.0/async_file_handle.hpp index b7133c61..853afc8e 100644 --- a/include/llfio/v2.0/async_file_handle.hpp +++ b/include/llfio/v2.0/async_file_handle.hpp @@ -505,7 +505,7 @@ public: using file_handle::write; LLFIO_HEADERS_ONLY_VIRTUAL_SPEC io_result<const_buffers_type> write(io_request<const_buffers_type> reqs, deadline d = deadline()) noexcept override; -#if LLFIO_HAVE_COROUTINES || defined(DOXYGEN_IS_IN_THE_HOUSE) +#if defined(LLFIO_ENABLE_COROUTINES) || defined(DOXYGEN_IS_IN_THE_HOUSE) private: template <class BuffersType> class awaitable_state { @@ -731,7 +731,7 @@ template <class CompletionRoutine> inline result<async_file_handle::io_state_ptr { return self.async_write(std::forward<decltype(reqs)>(reqs), std::forward<decltype(completion)>(completion), std::forward<decltype(mem)>(mem)); } -#if LLFIO_HAVE_COROUTINES || defined(DOXYGEN_IS_IN_THE_HOUSE) +#if defined(LLFIO_ENABLE_COROUTINES) || defined(DOXYGEN_IS_IN_THE_HOUSE) /*! \brief Schedule a read to occur asynchronously. \return An awaitable, which when `co_await`ed upon, suspends execution of the coroutine diff --git a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp index dfa79a29..e95bbda5 100644 --- a/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp +++ b/include/llfio/v2.0/detail/impl/posix/directory_handle.ipp @@ -26,7 +26,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include "import.hpp" #ifdef QUICKCPPLIB_ENABLE_VALGRIND -#include "../valgrind/memcheck.h" // from quickcpplib include directory +#include "quickcpplib/valgrind/memcheck.h" // from quickcpplib include directory #define LLFIO_VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(a, b) VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE((a), (b)) #else #define LLFIO_VALGRIND_MAKE_MEM_DEFINED_IF_ADDRESSABLE(a, b) diff --git a/include/llfio/v2.0/io_service.hpp b/include/llfio/v2.0/io_service.hpp index 1b8f590b..420836d8 100644 --- a/include/llfio/v2.0/io_service.hpp +++ b/include/llfio/v2.0/io_service.hpp @@ -31,30 +31,6 @@ Distributed under the Boost Software License, Version 1.0. #include <deque> #include <mutex> -#if defined(__cpp_coroutines) && !defined(LLFIO_HAVE_COROUTINES) -#define LLFIO_HAVE_COROUTINES 1 -#endif - -#if defined(LLFIO_HAVE_COROUTINES) -// clang-format off -#if defined(__has_include) -#if __has_include(<coroutine>) -#include <coroutine> -LLFIO_V2_NAMESPACE_EXPORT_BEGIN -template<class T = void> using coroutine_handle = std::coroutine_handle<T>; -LLFIO_V2_NAMESPACE_END -#elif __has_include(<experimental/coroutine>) -#include <experimental/coroutine> -LLFIO_V2_NAMESPACE_EXPORT_BEGIN -template<class T = void> using coroutine_handle = std::experimental::coroutine_handle<T>; -LLFIO_V2_NAMESPACE_END -#else -#error Cannot use C++ Coroutines without the <coroutine> header! -#endif -#endif -// clang-format on -#endif - #undef _threadid // windows macro splosh sigh //! \file io_service.hpp Provides io_service. @@ -291,7 +267,7 @@ public: */ template <class U> void post(U &&f) { _post(detail::make_function_ptr<void(io_service *)>(std::forward<U>(f))); } -#if LLFIO_HAVE_COROUTINES || defined(DOXYGEN_IS_IN_THE_HOUSE) +#if defined(LLFIO_ENABLE_COROUTINES) || defined(DOXYGEN_IS_IN_THE_HOUSE) /*! An awaitable suspending execution of this coroutine on the current kernel thread, and resuming execution on the kernel thread running this i/o service. This is a convenience wrapper for `post()`. @@ -309,7 +285,7 @@ public: bool await_ready() { return false; } void await_suspend(coroutine_handle<> co) { - service->post([co = co](io_service * /*unused*/) { co.resume(); }); + service->post([co = co](io_service * /*unused*/) mutable { co.resume(); }); } void await_resume() {} }; diff --git a/include/llfio/v2.0/status_code.hpp b/include/llfio/v2.0/status_code.hpp index 03c3c4c9..14a691c6 100644 --- a/include/llfio/v2.0/status_code.hpp +++ b/include/llfio/v2.0/status_code.hpp @@ -57,6 +57,12 @@ as that (a) enables safe header only LLFIO on Windows (b) produces better codege // Bring in a result implementation based on status_code #include "outcome/experimental/status_result.hpp" #include "outcome/try.hpp" +#if __cpp_coroutines +#include "outcome/experimental/coroutine_support.hpp" +#ifdef OUTCOME_FOUND_COROUTINE_HEADER +#define LLFIO_ENABLE_COROUTINES 1 +#endif +#endif LLFIO_V2_NAMESPACE_BEGIN @@ -241,6 +247,13 @@ template <class T> using result = OUTCOME_V2_NAMESPACE::experimental::status_res using OUTCOME_V2_NAMESPACE::failure; using OUTCOME_V2_NAMESPACE::in_place_type; using OUTCOME_V2_NAMESPACE::success; +#if defined(LLFIO_ENABLE_COROUTINES) +template <class T> using atomic_eager = OUTCOME_V2_NAMESPACE::experimental::awaitables::atomic_eager<T>; +template <class T> using atomic_lazy = OUTCOME_V2_NAMESPACE::experimental::awaitables::atomic_lazy<T>; +template <class T> using eager = OUTCOME_V2_NAMESPACE::experimental::awaitables::eager<T>; +template <class T> using lazy = OUTCOME_V2_NAMESPACE::experimental::awaitables::lazy<T>; +template <class T = void> using coroutine_handle = OUTCOME_V2_NAMESPACE::experimental::awaitables::coroutine_handle<T>; +#endif //! Choose an errc implementation using SYSTEM_ERROR2_NAMESPACE::errc; @@ -341,6 +354,12 @@ LLFIO_V2_NAMESPACE_END #include "outcome/result.hpp" #include "outcome/try.hpp" #include "outcome/utils.hpp" +#if __cpp_coroutines +#include "outcome/coroutine_support.hpp" +#ifdef OUTCOME_FOUND_COROUTINE_HEADER +#define LLFIO_ENABLE_COROUTINES 1 +#endif +#endif LLFIO_V2_NAMESPACE_BEGIN @@ -562,6 +581,13 @@ inline error_info error_from_exception(std::exception_ptr &&ep = std::current_ex return error_info(OUTCOME_V2_NAMESPACE::error_from_exception(std::move(ep), not_matched)); } using OUTCOME_V2_NAMESPACE::in_place_type; +#if defined(LLFIO_ENABLE_COROUTINES) +template <class T> using atomic_eager = OUTCOME_V2_NAMESPACE::awaitables::atomic_eager<T>; +template <class T> using atomic_lazy = OUTCOME_V2_NAMESPACE::awaitables::atomic_lazy<T>; +template <class T> using eager = OUTCOME_V2_NAMESPACE::awaitables::eager<T>; +template <class T> using lazy = OUTCOME_V2_NAMESPACE::awaitables::lazy<T>; +template <class T = void> using coroutine_handle = OUTCOME_V2_NAMESPACE::awaitables::coroutine_handle<T>; +#endif static_assert(OUTCOME_V2_NAMESPACE::trait::is_error_code_available_v<error_info>, "error_info is not detected to be an error code"); |