proxygen
folly::coro::TimedWaitAwaitable< Awaitable >::SharedState Class Reference

Public Member Functions

 SharedState (std::experimental::coroutine_handle<> ch, Try< await_resume_return_type > &storage)
 
void setValue (await_resume_return_type &&value)
 
void setException (exception_wrapper e)
 
void setTimeout ()
 

Private Attributes

std::atomic< bool > first_ {false}
 
std::experimental::coroutine_handle ch_
 
Try< await_resume_return_type > & storage_
 

Detailed Description

template<typename Awaitable>
class folly::coro::TimedWaitAwaitable< Awaitable >::SharedState

Definition at line 95 of file Utils.h.

Constructor & Destructor Documentation

template<typename Awaitable >
folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::SharedState ( std::experimental::coroutine_handle<>  ch,
Try< await_resume_return_type > &  storage 
)
inline

Definition at line 97 of file Utils.h.

100  : ch_(std::move(ch)), storage_(storage) {}
std::experimental::coroutine_handle ch_
Definition: Utils.h:129
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
auto ch
Try< await_resume_return_type > & storage_
Definition: Utils.h:130

Member Function Documentation

template<typename Awaitable >
void folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::setException ( exception_wrapper  e)
inline

Definition at line 111 of file Utils.h.

References folly::assume(), and folly::gen::move.

111  {
112  if (first_.exchange(true, std::memory_order_relaxed)) {
113  return;
114  }
117  ch_();
118  }
std::experimental::coroutine_handle ch_
Definition: Utils.h:129
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
bool hasException() const
Definition: Try.h:248
Try< await_resume_return_type > & storage_
Definition: Utils.h:130
bool hasValue() const
Definition: Try.h:242
exception_wrapper & emplaceException(Args &&...args) noexcept(std::is_nothrow_constructible< exception_wrapper, Args &&... >::value)
Definition: Try-inl.h:131
FOLLY_ALWAYS_INLINE void assume(bool cond)
Definition: Assume.h:41
template<typename Awaitable >
void folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::setTimeout ( )
inline

Definition at line 120 of file Utils.h.

120  {
121  if (first_.exchange(true, std::memory_order_relaxed)) {
122  return;
123  }
124  ch_();
125  }
std::experimental::coroutine_handle ch_
Definition: Utils.h:129
template<typename Awaitable >
void folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::setValue ( await_resume_return_type &&  value)
inline

Definition at line 102 of file Utils.h.

References folly::assume(), folly::tryEmplace(), and folly::value().

102  {
103  if (first_.exchange(true, std::memory_order_relaxed)) {
104  return;
105  }
107  tryEmplace(storage_, static_cast<await_resume_return_type&&>(value));
108  ch_();
109  }
T * tryEmplace(Try< T > &t, Args &&...args) noexcept
Definition: Try-inl.h:249
std::experimental::coroutine_handle ch_
Definition: Utils.h:129
bool hasException() const
Definition: Try.h:248
Try< await_resume_return_type > & storage_
Definition: Utils.h:130
bool hasValue() const
Definition: Try.h:242
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
FOLLY_ALWAYS_INLINE void assume(bool cond)
Definition: Assume.h:41

Member Data Documentation

template<typename Awaitable >
std::experimental::coroutine_handle folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::ch_
private

Definition at line 129 of file Utils.h.

template<typename Awaitable >
std::atomic<bool> folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::first_ {false}
private

Definition at line 128 of file Utils.h.

template<typename Awaitable >
Try<await_resume_return_type>& folly::coro::TimedWaitAwaitable< Awaitable >::SharedState::storage_
private

Definition at line 130 of file Utils.h.


The documentation for this class was generated from the following file: