proxygen
folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry Class Reference

Public Member Functions

template<typename Arg >
FOLLY_ALWAYS_INLINE void putItem (Arg &&arg)
 
FOLLY_ALWAYS_INLINE void takeItem (T &item) noexcept
 
FOLLY_ALWAYS_INLINE folly::Optional< TtakeItem () noexcept
 
FOLLY_ALWAYS_INLINE const TpeekItem () noexcept
 
template<typename Clock , typename Duration >
FOLLY_ALWAYS_INLINE bool tryWaitUntil (const std::chrono::time_point< Clock, Duration > &deadline) noexcept
 
FOLLY_ALWAYS_INLINE void destroyItem () noexcept
 

Private Member Functions

FOLLY_ALWAYS_INLINE void getItem (T &item) noexcept
 
FOLLY_ALWAYS_INLINE folly::Optional< TgetItem () noexcept
 
FOLLY_ALWAYS_INLINE TitemPtr () noexcept
 

Private Attributes

folly::SaturatingSemaphore< MayBlock, Atomflag_
 
std::aligned_storage< sizeof(T), alignof(T)>::type item_
 

Detailed Description

template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
class folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry

Entry

Definition at line 744 of file UnboundedQueue.h.

Member Function Documentation

template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE void folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::destroyItem ( )
inlinenoexcept

Definition at line 779 of file UnboundedQueue.h.

779  {
780  itemPtr()->~T();
781  }
FOLLY_ALWAYS_INLINE T * itemPtr() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE void folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::getItem ( T item)
inlineprivatenoexcept

Definition at line 784 of file UnboundedQueue.h.

References folly::gen::move.

784  {
785  item = std::move(*(itemPtr()));
786  destroyItem();
787  }
FOLLY_ALWAYS_INLINE void destroyItem() noexcept
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
FOLLY_ALWAYS_INLINE T * itemPtr() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE folly::Optional<T> folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::getItem ( )
inlineprivatenoexcept

Definition at line 789 of file UnboundedQueue.h.

References folly::gen::move.

789  {
791  destroyItem();
792  return ret;
793  }
FOLLY_ALWAYS_INLINE void destroyItem() noexcept
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
FOLLY_ALWAYS_INLINE T * itemPtr() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE T* folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::itemPtr ( )
inlineprivatenoexcept

Definition at line 795 of file UnboundedQueue.h.

References folly::T.

795  {
796  return static_cast<T*>(static_cast<void*>(&item_));
797  }
folly::std T
std::aligned_storage< sizeof(T), alignof(T)>::type item_
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE const T* folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::peekItem ( )
inlinenoexcept

Definition at line 765 of file UnboundedQueue.h.

References folly::SaturatingSemaphore< MayBlock, Atom >::wait().

765  {
766  flag_.wait();
767  return itemPtr();
768  }
folly::SaturatingSemaphore< MayBlock, Atom > flag_
FOLLY_ALWAYS_INLINE T * itemPtr() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
template<typename Arg >
FOLLY_ALWAYS_INLINE void folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::putItem ( Arg &&  arg)
inline

Definition at line 750 of file UnboundedQueue.h.

References folly::SaturatingSemaphore< MayBlock, Atom >::post(), and folly::T.

750  {
751  new (&item_) T(std::forward<Arg>(arg));
752  flag_.post();
753  }
folly::std T
folly::SaturatingSemaphore< MayBlock, Atom > flag_
std::aligned_storage< sizeof(T), alignof(T)>::type item_
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE void folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::takeItem ( T item)
inlinenoexcept

Definition at line 755 of file UnboundedQueue.h.

References folly::SaturatingSemaphore< MayBlock, Atom >::wait().

755  {
756  flag_.wait();
757  getItem(item);
758  }
folly::SaturatingSemaphore< MayBlock, Atom > flag_
FOLLY_ALWAYS_INLINE folly::Optional< T > getItem() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
FOLLY_ALWAYS_INLINE folly::Optional<T> folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::takeItem ( )
inlinenoexcept

Definition at line 760 of file UnboundedQueue.h.

References folly::SaturatingSemaphore< MayBlock, Atom >::wait().

760  {
761  flag_.wait();
762  return getItem();
763  }
folly::SaturatingSemaphore< MayBlock, Atom > flag_
FOLLY_ALWAYS_INLINE folly::Optional< T > getItem() noexcept
template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
template<typename Clock , typename Duration >
FOLLY_ALWAYS_INLINE bool folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::tryWaitUntil ( const std::chrono::time_point< Clock, Duration > &  deadline)
inlinenoexcept

Definition at line 771 of file UnboundedQueue.h.

References folly::SaturatingSemaphore< MayBlock, Atom >::try_wait_until(), and folly::SaturatingSemaphore< MayBlock, Atom >::wait_options().

772  {
773  // wait-options from benchmarks on contended queues:
774  auto const opt =
775  flag_.wait_options().spin_max(std::chrono::microseconds(10));
776  return flag_.try_wait_until(deadline, opt);
777  }
folly::SaturatingSemaphore< MayBlock, Atom > flag_

Member Data Documentation

template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
folly::SaturatingSemaphore<MayBlock, Atom> folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::flag_
private

Definition at line 745 of file UnboundedQueue.h.

template<typename T, bool SingleProducer, bool SingleConsumer, bool MayBlock, size_t LgSegmentSize = 8, size_t LgAlign = constexpr_log2(hardware_destructive_interference_size), template< typename > class Atom = std::atomic>
std::aligned_storage<sizeof(T), alignof(T)>::type folly::UnboundedQueue< T, SingleProducer, SingleConsumer, MayBlock, LgSegmentSize, LgAlign, Atom >::Entry::item_
private

Definition at line 746 of file UnboundedQueue.h.


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