proxygen
folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all > Class Template Reference

Public Member Functions

 Executor (size_t threads, const Ops *ops)
 
 ~Executor ()
 
void closeInputProducer ()
 
void closeOutputConsumer ()
 
bool writeUnlessClosed (Input &&input)
 
bool writeUnlessFull (Input &&input)
 
bool readUnlessClosed (OutputDecayed &output)
 
bool readUnlessEmpty (OutputDecayed &output)
 

Private Member Functions

void work ()
 

Private Attributes

InQueue inQueue_
 
OutQueue outQueue_
 
Puller puller_
 
Pusher< allpusher_
 
std::vector< std::thread > workers_
 
const Ops * ops_
 

Detailed Description

template<class Ops>
template<class Input, class Source, class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
class folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >

Definition at line 230 of file Parallel-inl.h.

Constructor & Destructor Documentation

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::Executor ( size_t  threads,
const Ops *  ops 
)
inline

Definition at line 243 of file Parallel-inl.h.

References folly::gen::detail::ClosableMPMCQueue< T >::closeInputProducer(), folly::gen::detail::ClosableMPMCQueue< T >::closeOutputConsumer(), folly::gen::detail::ClosableMPMCQueue< T >::openConsumer(), folly::gen::detail::ClosableMPMCQueue< T >::openProducer(), SCOPE_EXIT, folly::pushmi::detail::t, and threads.

244  : inQueue_(threads * 4),
245  outQueue_(threads * 4),
246  puller_(&inQueue_),
247  pusher_(&outQueue_),
248  ops_(ops) {
251  for (size_t t = 0; t < threads; ++t) {
254  workers_.emplace_back([this] {
255  SCOPE_EXIT {
258  };
259  this->work();
260  });
261  }
262  }
#define SCOPE_EXIT
Definition: ScopeGuard.h:274
std::vector< std::thread::id > threads
const int ops
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::~Executor ( )
inline

Member Function Documentation

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
void folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::closeInputProducer ( )
inline
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
void folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::closeOutputConsumer ( )
inline
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
bool folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::readUnlessClosed ( OutputDecayed &  output)
inline
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
bool folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::readUnlessEmpty ( OutputDecayed &  output)
inline
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
void folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::work ( )
inlineprivate
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
bool folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::writeUnlessClosed ( Input &&  input)
inline
template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
bool folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::writeUnlessFull ( Input &&  input)
inline

Member Data Documentation

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
InQueue folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::inQueue_
private

Definition at line 231 of file Parallel-inl.h.

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
const Ops* folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::ops_
private

Definition at line 236 of file Parallel-inl.h.

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
OutQueue folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::outQueue_
private

Definition at line 232 of file Parallel-inl.h.

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
Puller folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::puller_
private

Definition at line 233 of file Parallel-inl.h.

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
Pusher<all> folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::pusher_
private

Definition at line 234 of file Parallel-inl.h.

template<class Ops >
template<class Input , class Source , class InputDecayed = typename std::decay<Input>::type, class Composed = decltype(std::declval<Ops>().compose(Empty<InputDecayed&&>())), class Output = typename Composed::ValueType, class OutputDecayed = typename std::decay<Output>::type>
template<bool all = false>
std::vector<std::thread> folly::gen::detail::Parallel< Ops >::Generator< Input, Source, InputDecayed, Composed, Output, OutputDecayed >::Executor< all >::workers_
private

Definition at line 235 of file Parallel-inl.h.


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