D++ (DPP)
C++ Discord API Bot Library
dpp::basic_awaitable< Derived > Class Template Reference

#include <awaitable.h>

+ Inheritance diagram for dpp::basic_awaitable< Derived >:

Public Member Functions

auto sync_wait ()
 Blocks this thread and waits for the awaitable to finish. More...
 
template<class Rep , class Period >
auto sync_wait_for (const std::chrono::duration< Rep, Period > &duration)
 Blocks this thread and waits for the awaitable to finish. More...
 
template<class Clock , class Duration >
auto sync_wait_until (const std::chrono::time_point< Clock, Duration > &time)
 Blocks this thread and waits for the awaitable to finish. More...
 

Protected Member Functions

template<bool Timed>
auto sync_wait_impl (auto &&do_wait)
 Implementation for sync_wait. This is code used by sync_wait, sync_wait_for, sync_wait_until. More...
 

Member Function Documentation

◆ sync_wait()

template<typename Derived >
auto dpp::basic_awaitable< Derived >::sync_wait ( )
inline

Blocks this thread and waits for the awaitable to finish.

Attention
This will BLOCK THE THREAD. It is likely you want to use co_await instead.
Returns
If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.
If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

◆ sync_wait_for()

template<typename Derived >
template<class Rep , class Period >
auto dpp::basic_awaitable< Derived >::sync_wait_for ( const std::chrono::duration< Rep, Period > &  duration)
inline

Blocks this thread and waits for the awaitable to finish.

Attention
This will BLOCK THE THREAD. It is likely you want to use co_await instead.
Parameters
durationMaximum duration to wait for
Returns
If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.
If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

◆ sync_wait_impl()

template<typename Derived >
template<bool Timed>
auto dpp::basic_awaitable< Derived >::sync_wait_impl ( auto &&  do_wait)
inlineprotected

Implementation for sync_wait. This is code used by sync_wait, sync_wait_for, sync_wait_until.

Template Parameters
TimedWhether the wait function times out or not
Parameters
do_waitFunction to do the actual wait on the cv
Returns
If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.
If T is non-void, returns a std::optional<T> for which an absence of value means timed out.

◆ sync_wait_until()

template<typename Derived >
template<class Clock , class Duration >
auto dpp::basic_awaitable< Derived >::sync_wait_until ( const std::chrono::time_point< Clock, Duration > &  time)
inline

Blocks this thread and waits for the awaitable to finish.

Attention
This will BLOCK THE THREAD. It is likely you want to use co_await instead.
Parameters
timeMaximum time point to wait for
Returns
If T is void, returns a boolean for which true means the awaitable completed, false means it timed out.
If T is non-void, returns a std::optional<T> for which an absence of value means timed out.
D++ Library version 10.0.34D++ Library version 10.0.33D++ Library version 10.0.32D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0