/////////////////////////////////////////////////////////////////////////////// // Copyright (c) Lewis Baker // Licenced under MIT license. See LICENSE.txt for details. /////////////////////////////////////////////////////////////////////////////// #ifndef CPPCORO_SYNC_WAIT_HPP_INCLUDED #define CPPCORO_SYNC_WAIT_HPP_INCLUDED #include #include #include #include #include namespace cppcoro { template auto sync_wait(AWAITABLE&& awaitable) -> typename cppcoro::awaitable_traits::await_result_t { auto task = detail::make_sync_wait_task(awaitable); detail::lightweight_manual_reset_event event; task.start(event); event.wait(); return task.result(); } } #endif