proxygen
folly::MPMCPipeline< In, Stages >::Ticket< Stage > Class Template Reference

#include <MPMCPipeline.h>

Inheritance diagram for folly::MPMCPipeline< In, Stages >::Ticket< Stage >:

Public Member Functions

 ~Ticket () noexcept
 
 Ticket () noexcept
 
 Ticket (Ticket &&other) noexcept
 
Ticketoperator= (Ticket &&other) noexcept
 

Private Member Functions

 Ticket (MPMCPipeline *owner, size_t amplification, uint64_t value) noexcept
 
uint64_t use (MPMCPipeline *owner)
 

Private Attributes

size_t remainingUses_
 

Friends

class MPMCPipeline
 

Detailed Description

template<class In, class... Stages>
template<size_t Stage>
class folly::MPMCPipeline< In, Stages >::Ticket< Stage >

Ticket, returned by blockingReadStage, must be given back to blockingWriteStage. Tickets are not thread-safe.

Definition at line 143 of file MPMCPipeline.h.

Constructor & Destructor Documentation

template<class In, class... Stages>
template<size_t Stage>
folly::MPMCPipeline< In, Stages >::Ticket< Stage >::~Ticket ( )
inlinenoexcept

Definition at line 145 of file MPMCPipeline.h.

145  {
146  CHECK_EQ(remainingUses_, 0) << "All tickets must be completely used!";
147  }
template<class In, class... Stages>
template<size_t Stage>
folly::MPMCPipeline< In, Stages >::Ticket< Stage >::Ticket ( )
inlinenoexcept

Definition at line 149 of file MPMCPipeline.h.

template<class In, class... Stages>
template<size_t Stage>
folly::MPMCPipeline< In, Stages >::Ticket< Stage >::Ticket ( Ticket< Stage > &&  other)
inlinenoexcept

Definition at line 151 of file MPMCPipeline.h.

152  : TicketBase(static_cast<TicketBase&&>(other)),
153  remainingUses_(std::exchange(other.remainingUses_, 0)) {}
std::conditional_t< kIsDebug, TicketBaseDebug, TicketBaseNDebug > TicketBase
Definition: MPMCPipeline.h:135
T exchange(T &obj, U &&new_value)
Definition: Utility.h:120
template<class In, class... Stages>
template<size_t Stage>
folly::MPMCPipeline< In, Stages >::Ticket< Stage >::Ticket ( MPMCPipeline owner,
size_t  amplification,
uint64_t  value 
)
inlineprivatenoexcept

Definition at line 167 of file MPMCPipeline.h.

168  : TicketBase(owner, value * amplification),
169  remainingUses_(amplification) {}
std::conditional_t< kIsDebug, TicketBaseDebug, TicketBaseNDebug > TicketBase
Definition: MPMCPipeline.h:135
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)

Member Function Documentation

template<class In, class... Stages>
template<size_t Stage>
Ticket& folly::MPMCPipeline< In, Stages >::Ticket< Stage >::operator= ( Ticket< Stage > &&  other)
inlinenoexcept

Definition at line 155 of file MPMCPipeline.h.

References folly::gen::move.

155  {
156  if (this != &other) {
157  this->~Ticket();
158  new (this) Ticket(std::move(other));
159  }
160  return *this;
161  }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class In, class... Stages>
template<size_t Stage>
uint64_t folly::MPMCPipeline< In, Stages >::Ticket< Stage >::use ( MPMCPipeline owner)
inlineprivate

Definition at line 171 of file MPMCPipeline.h.

References folly::MPMCPipeline< In, Stages >::MPMCPipeline().

171  {
172  CHECK_GT(remainingUses_--, 0);
173  TicketBase::check_owner(owner);
174  return TicketBase::value_++;
175  }

Friends And Related Function Documentation

template<class In, class... Stages>
template<size_t Stage>
friend class MPMCPipeline
friend

Definition at line 164 of file MPMCPipeline.h.

Member Data Documentation

template<class In, class... Stages>
template<size_t Stage>
size_t folly::MPMCPipeline< In, Stages >::Ticket< Stage >::remainingUses_
private

Definition at line 165 of file MPMCPipeline.h.


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