| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
dpp::basic_awaitable< Derived > Class Template Reference

`#include <awaitable.h>`

Inheritance diagram for dpp::basic_awaitable< Derived >:
[legend]

## Public Member Functions

auto | sync_wait ()
| Blocks this thread and waits for the awaitable to finish.
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.
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.

## 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.

## 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

  duration | Maximum 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 | ) |

inline protected

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

Template Parameters

  Timed | Whether the wait function times out or not

Parameters

  do_wait | Function 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

  time | Maximum 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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0