proxygen
|
#include <MPMCQueue.h>
Classes | |
struct | ImplByMove |
struct | ImplByRelocation |
Tag classes for dispatching to enqueue/dequeue implementation. More... | |
Public Member Functions | |
~SingleElementQueue () noexcept | |
template<typename... Args, typename = typename std::enable_if< std::is_nothrow_constructible<T, Args...>::value>::type> | |
void | enqueue (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, Args &&...args) noexcept |
enqueue using in-place noexcept construction More... | |
template<typename = typename std::enable_if< (folly::IsRelocatable<T>::value && std::is_nothrow_constructible<T>::value) || std::is_nothrow_constructible<T, T&&>::value>::type> | |
void | enqueue (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &&goner) noexcept |
template<class Clock > | |
bool | tryWaitForEnqueueTurnUntil (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, const std::chrono::time_point< Clock > &when) noexcept |
bool | mayEnqueue (const uint32_t turn) const noexcept |
void | dequeue (uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &elem) noexcept |
template<class Clock > | |
bool | tryWaitForDequeueTurnUntil (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, const std::chrono::time_point< Clock > &when) noexcept |
bool | mayDequeue (const uint32_t turn) const noexcept |
Private Member Functions | |
T * | ptr () noexcept |
void | destroyContents () noexcept |
void | enqueueImpl (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &&goner, ImplByMove) noexcept |
enqueue using nothrow move construction. More... | |
void | enqueueImpl (const uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &&goner, ImplByRelocation) noexcept |
void | dequeueImpl (uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &elem, ImplByRelocation) noexcept |
void | dequeueImpl (uint32_t turn, Atom< uint32_t > &spinCutoff, const bool updateSpinCutoff, T &elem, ImplByMove) noexcept |
dequeue by nothrow move assignment. More... | |
Private Attributes | |
std::aligned_storage< sizeof(T), alignof(T)>::type | contents_ |
Storage for a T constructed with placement new. More... | |
TurnSequencer< Atom > | sequencer_ |
Even turns are pushes, odd turns are pops. More... | |
SingleElementQueue implements a blocking queue that holds at most one item, and that requires its users to assign incrementing identifiers (turns) to each enqueue and dequeue operation. Note that the turns used by SingleElementQueue are doubled inside the TurnSequencer
Definition at line 38 of file MPMCQueue.h.
|
inlinenoexcept |
Definition at line 1340 of file MPMCQueue.h.
References testing::Args(), folly::T, type, and folly::value().
|
inlinenoexcept |
Definition at line 1405 of file MPMCQueue.h.
References type.
|
inlineprivatenoexcept |
dequeue by destructing followed by relocation. This version is preferred, because as much work as possible can be done before waiting.
Definition at line 1494 of file MPMCQueue.h.
References folly::detail::TurnSequencer< Atom >::completeTurn(), and folly::detail::TurnSequencer< Atom >::waitForTurn().
|
inlineprivatenoexcept |
dequeue by nothrow move assignment.
Definition at line 1511 of file MPMCQueue.h.
References folly::detail::TurnSequencer< Atom >::completeTurn(), folly::gen::move, ptr, and folly::detail::TurnSequencer< Atom >::waitForTurn().
|
inlineprivatenoexcept |
Definition at line 1451 of file MPMCQueue.h.
References ptr.
|
inlinenoexcept |
enqueue using in-place noexcept construction
Definition at line 1352 of file MPMCQueue.h.
References folly::T, type, and value.
Referenced by folly::detail::MPMCQueueBase< Derived< T, Atom, Dynamic > >::enqueueWithTicketBase().
|
inlinenoexcept |
enqueue using move construction, either real (if is_nothrow_move_constructible) or simulated using relocation and default construction (if IsRelocatable and is_nothrow_constructible)
Definition at line 1370 of file MPMCQueue.h.
References folly::gen::move, type, and value.
|
inlineprivatenoexcept |
enqueue using nothrow move construction.
Definition at line 1467 of file MPMCQueue.h.
References folly::detail::TurnSequencer< Atom >::completeTurn(), folly::gen::move, folly::T, and folly::detail::TurnSequencer< Atom >::waitForTurn().
|
inlineprivatenoexcept |
enqueue by simulating nothrow move with relocation, followed by default construction to a noexcept relocation.
Definition at line 1480 of file MPMCQueue.h.
References folly::detail::TurnSequencer< Atom >::completeTurn(), folly::T, and folly::detail::TurnSequencer< Atom >::waitForTurn().
|
inlinenoexcept |
Definition at line 1436 of file MPMCQueue.h.
|
inlinenoexcept |
Definition at line 1401 of file MPMCQueue.h.
|
inlineprivatenoexcept |
Definition at line 1447 of file MPMCQueue.h.
|
inlinenoexcept |
Waits until either: 1: the enqueue turn preceding the given dequeue turn has arrived 2: the given deadline has arrived Case 1 returns true, case 2 returns false.
Definition at line 1426 of file MPMCQueue.h.
References folly::when().
|
inlinenoexcept |
Waits until either: 1: the dequeue turn preceding the given enqueue turn has arrived 2: the given deadline has arrived Case 1 returns true, case 2 returns false.
Definition at line 1391 of file MPMCQueue.h.
References folly::when().
|
private |
Storage for a T constructed with placement new.
Definition at line 1442 of file MPMCQueue.h.
|
private |
Even turns are pushes, odd turns are pops.
Definition at line 1445 of file MPMCQueue.h.