|
| DynamicBoundedQueue (Weight capacity) |
|
| ~DynamicBoundedQueue () |
|
FOLLY_ALWAYS_INLINE void | enqueue (const T &v) |
| Enqueue functions. More...
|
|
FOLLY_ALWAYS_INLINE void | enqueue (T &&v) |
|
FOLLY_ALWAYS_INLINE bool | try_enqueue (const T &v) |
|
FOLLY_ALWAYS_INLINE bool | try_enqueue (T &&v) |
|
template<typename Clock , typename Duration > |
FOLLY_ALWAYS_INLINE bool | try_enqueue_until (const T &v, const std::chrono::time_point< Clock, Duration > &deadline) |
|
template<typename Clock , typename Duration > |
FOLLY_ALWAYS_INLINE bool | try_enqueue_until (T &&v, const std::chrono::time_point< Clock, Duration > &deadline) |
|
template<typename Rep , typename Period > |
FOLLY_ALWAYS_INLINE bool | try_enqueue_for (const T &v, const std::chrono::duration< Rep, Period > &duration) |
|
template<typename Rep , typename Period > |
FOLLY_ALWAYS_INLINE bool | try_enqueue_for (T &&v, const std::chrono::duration< Rep, Period > &duration) |
|
FOLLY_ALWAYS_INLINE void | dequeue (T &elem) |
| Dequeue functions. More...
|
|
FOLLY_ALWAYS_INLINE bool | try_dequeue (T &elem) |
|
template<typename Clock , typename Duration > |
FOLLY_ALWAYS_INLINE bool | try_dequeue_until (T &elem, const std::chrono::time_point< Clock, Duration > &deadline) |
|
template<typename Rep , typename Period > |
FOLLY_ALWAYS_INLINE bool | try_dequeue_for (T &elem, const std::chrono::duration< Rep, Period > &duration) |
|
void | reset_capacity (Weight capacity) noexcept |
| Secondary functions. More...
|
|
Weight | weight () const noexcept |
|
size_t | size () const noexcept |
|
bool | empty () const noexcept |
|
|
constexpr Weight | threshold (Weight capacity) const noexcept |
| Private functions ///. More...
|
|
template<typename Arg > |
FOLLY_ALWAYS_INLINE void | enqueueImpl (Arg &&v) |
|
template<typename Arg > |
FOLLY_ALWAYS_INLINE bool | tryEnqueueImpl (Arg &&v) |
|
template<typename Clock , typename Duration , typename Arg > |
FOLLY_ALWAYS_INLINE bool | tryEnqueueUntilImpl (Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline) |
|
template<typename Rep , typename Period , typename Arg > |
FOLLY_ALWAYS_INLINE bool | tryEnqueueForImpl (Arg &&v, const std::chrono::duration< Rep, Period > &duration) |
|
FOLLY_ALWAYS_INLINE bool | tryAddDebit (Weight weight) noexcept |
|
FOLLY_ALWAYS_INLINE Weight | getCapacity () const noexcept |
|
FOLLY_ALWAYS_INLINE Weight | fetchAddDebit (Weight weight) noexcept |
|
FOLLY_ALWAYS_INLINE Weight | getDebit () const noexcept |
|
FOLLY_ALWAYS_INLINE void | addCredit (Weight weight) noexcept |
|
FOLLY_ALWAYS_INLINE Weight | fetchAddCredit (Weight weight) noexcept |
|
FOLLY_ALWAYS_INLINE Weight | getCredit () const noexcept |
|
FOLLY_ALWAYS_INLINE Weight | getThreshold () const noexcept |
|
void | subDebit (Weight weight) noexcept |
|
template<typename Clock , typename Duration , typename Arg > |
bool | tryEnqueueUntilSlow (Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline) |
|
template<typename Clock , typename Duration > |
bool | canEnqueue (const std::chrono::time_point< Clock, Duration > &deadline, Weight weight) noexcept |
|
bool | canBlock (Weight weight, Weight capacity) noexcept |
|
bool | tryReduceDebit () noexcept |
|
Weight | takeTransfer () noexcept |
|
Weight | getTransfer () const noexcept |
|
void | transferCredit () noexcept |
|
Weight | takeCredit () noexcept |
|
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
class folly::DynamicBoundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, WeightFn, Atom >
Definition at line 287 of file DynamicBoundedQueue.h.
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration >
Definition at line 589 of file DynamicBoundedQueue.h.
References folly::asm_volatile_pause(), folly::detail::futexWaitUntil(), max, and now().
Weight weight() const noexcept
std::chrono::steady_clock::time_point now()
bool tryReduceDebit() noexcept
FOLLY_ALWAYS_INLINE Weight getCapacity() const noexcept
bool canBlock(Weight weight, Weight capacity) noexcept
FOLLY_ALWAYS_INLINE Weight getDebit() const noexcept
FutexResult futexWaitUntil(const Futex *futex, uint32_t expected, std::chrono::time_point< Clock, Duration > const &deadline, uint32_t waitMask)
detail::Futex< Atom > waiting_
FOLLY_ALWAYS_INLINE bool tryAddDebit(Weight weight) noexcept
void asm_volatile_pause()
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Rep , typename Period >
try_dequeue_for
Definition at line 420 of file DynamicBoundedQueue.h.
Referenced by enq_deq_test().
423 if (
q_.try_dequeue_for(elem, duration)) {
FOLLY_ALWAYS_INLINE void addCredit(Weight weight) noexcept
UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom > q_
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration >
try_dequeue_until
Definition at line 408 of file DynamicBoundedQueue.h.
411 if (
q_.try_dequeue_until(elem, deadline)) {
FOLLY_ALWAYS_INLINE void addCredit(Weight weight) noexcept
UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom > q_
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Rep , typename Period >
try_enqueue_for
Definition at line 376 of file DynamicBoundedQueue.h.
Referenced by enq_deq_test().
FOLLY_ALWAYS_INLINE bool tryEnqueueForImpl(Arg &&v, const std::chrono::duration< Rep, Period > &duration)
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Rep , typename Period >
Definition at line 383 of file DynamicBoundedQueue.h.
References folly::gen::move.
constexpr detail::Map< Move > move
FOLLY_ALWAYS_INLINE bool tryEnqueueForImpl(Arg &&v, const std::chrono::duration< Rep, Period > &duration)
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration >
try_enqueue_until
Definition at line 361 of file DynamicBoundedQueue.h.
FOLLY_ALWAYS_INLINE bool tryEnqueueUntilImpl(Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline)
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration >
Definition at line 368 of file DynamicBoundedQueue.h.
References folly::gen::move.
constexpr detail::Map< Move > move
FOLLY_ALWAYS_INLINE bool tryEnqueueUntilImpl(Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline)
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Rep , typename Period , typename Arg >
Definition at line 493 of file DynamicBoundedQueue.h.
References LIKELY, and now().
std::chrono::steady_clock::time_point now()
FOLLY_ALWAYS_INLINE bool tryEnqueueImpl(Arg &&v)
bool tryEnqueueUntilSlow(Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline)
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration , typename Arg >
Definition at line 481 of file DynamicBoundedQueue.h.
References LIKELY, and v.
486 q_.enqueue(std::forward<Arg>(
v));
Weight weight() const noexcept
bool tryEnqueueUntilSlow(Arg &&v, const std::chrono::time_point< Clock, Duration > &deadline)
UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom > q_
FOLLY_ALWAYS_INLINE bool tryAddDebit(Weight weight) noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration , typename Arg >
bool folly::DynamicBoundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, WeightFn, Atom >::tryEnqueueUntilSlow |
( |
Arg && |
v, |
|
|
const std::chrono::time_point< Clock, Duration > & |
deadline |
|
) |
| |
|
inlineprivate |
Definition at line 576 of file DynamicBoundedQueue.h.
References v.
581 q_.enqueue(std::forward<Arg>(
v));
Weight weight() const noexcept
UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom > q_
bool canEnqueue(const std::chrono::time_point< Clock, Duration > &deadline, Weight weight) noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = 7, typename WeightFn = DefaultWeightFn<T>, template< typename > class Atom = std::atomic>
constexpr bool folly::DynamicBoundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, WeightFn, Atom >::SPSC = SingleProducer && SingleConsumer |
|
staticprivate |