proxygen
folly::pushmi::strand_executor< E, Executor > Class Template Reference

#include <strand.h>

Public Types

using properties = property_set< is_sender<>, is_executor<>, property_set_index_t< properties_t< Executor >, is_never_blocking<>>, is_fifo_sequence<>, is_single<>>
 

Public Member Functions

 strand_executor (std::shared_ptr< strand_queue< E, Executor >> queue)
 
auto executor ()
 
requires ReceiveValue< Out, any_executor_ref< E > > &&ReceiveError< Out, E > void submit (Out out)
 

Private Attributes

std::shared_ptr< strand_queue< E, Executor > > queue_
 

Detailed Description

template<class E, class Executor>
class folly::pushmi::strand_executor< E, Executor >

Definition at line 27 of file strand.h.

Member Typedef Documentation

Constructor & Destructor Documentation

template<class E , class Executor >
folly::pushmi::strand_executor< E, Executor >::strand_executor ( std::shared_ptr< strand_queue< E, Executor >>  queue)
inline

Definition at line 190 of file strand.h.

191  : queue_(std::move(queue)) {}
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
std::shared_ptr< strand_queue< E, Executor > > queue_
Definition: strand.h:180

Member Function Documentation

template<class E , class Executor >
auto folly::pushmi::strand_executor< E, Executor >::executor ( )
inline

Definition at line 193 of file strand.h.

References folly::pushmi::PUSHMI_TEMPLATE(), and folly::pushmi::requires().

193  {
194  return *this;
195  }
template<class E , class Executor >
requires ReceiveValue<Out, any_executor_ref<E> >&& ReceiveError<Out, E> void folly::pushmi::strand_executor< E, Executor >::submit ( Out  out)
inline

Definition at line 200 of file strand.h.

References folly::gen::guard(), folly::gen::move, and submit.

200  {
201  // queue for later
202  std::unique_lock<std::mutex> guard{queue_->lock_};
203  queue_->items_.push(any_receiver<E, any_executor_ref<E>>{std::move(out)});
204  if (queue_->remaining_ == 0) {
205  // noone is minding the shop, send a worker
207  queue_->ex_, strand_queue_receiver<E, Executor>{queue_});
208  }
209  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
GuardImpl guard(ErrorHandler &&handler)
Definition: Base.h:840
std::shared_ptr< strand_queue< E, Executor > > queue_
Definition: strand.h:180

Member Data Documentation

template<class E , class Executor >
std::shared_ptr<strand_queue<E, Executor> > folly::pushmi::strand_executor< E, Executor >::queue_
private

Definition at line 180 of file strand.h.


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