#include <job_queue.hpp>
Definition at line 376 of file job_queue.hpp.
◆ Job::MPMCQueue::IndexRange
| struct Job::MPMCQueue::IndexRange |
◆ size_type
◆ atomic_size_type
◆ value_type
◆ MPMCQueue()
| Job::MPMCQueue::MPMCQueue |
( |
| ) |
|
|
default |
◆ ~MPMCQueue()
| Job::MPMCQueue::~MPMCQueue |
( |
| ) |
|
|
default |
◆ Initialize()
◆ PushExact()
Definition at line 417 of file job_queue.hpp.
419 return PushImpl<true>(elements, num_elements) != 0u;
◆ PushUpTo()
Definition at line 422 of file job_queue.hpp.
424 return PushImpl<false>(elements, num_elements);
◆ PopExact()
Definition at line 427 of file job_queue.hpp.
429 return PopImpl<true>(out_elements, num_elements) != 0u;
◆ PopUpTo()
Definition at line 432 of file job_queue.hpp.
434 return PopImpl<false>(out_elements, num_elements);
◆ PushImpl()
template<bool allOrNothing>
Definition at line 439 of file job_queue.hpp.
442 if (RequestWriteRange<allOrNothing>(&range, num_elements))
446 return written_elements;
void Commit(atomic_size_type *commit, const IndexRange range) const
size_type WriteElements(const value_type *const elements, const IndexRange range)
References Commit(), m_ProducerCommited, and WriteElements().
◆ PopImpl()
template<bool allOrNothing>
◆ RequestWriteRange()
template<bool allOrNothing>
Definition at line 467 of file job_queue.hpp.
477 if constexpr (allOrNothing)
479 if (capacity_left < num_items)
485 if (capacity_left == 0)
490 const size_type num_element_to_write = capacity_left < num_items ? capacity_left : num_items;
492 new_head = old_head + num_element_to_write;
494 }
while (!
m_ProducerPending.compare_exchange_weak(old_head, new_head, std::memory_order_relaxed, std::memory_order_relaxed));
496 *out_range = {old_head, new_head};
size_type Distance(const size_type a, const size_type b) const
References Distance(), m_ConsumerCommited, and m_ProducerPending.
◆ RequestPopRange()
template<bool allOrNothing>
Definition at line 501 of file job_queue.hpp.
511 size_t capacity_left = (
m_Capacity - distance);
512 if constexpr (allOrNothing)
514 if (capacity_left < num_items)
525 const size_type num_element_to_read = capacity_left < num_items ? capacity_left : num_items;
527 new_tail = old_tail + num_element_to_read;
529 }
while (!
m_ConsumerPending.compare_exchange_weak(old_tail, new_tail, std::memory_order_relaxed, std::memory_order_relaxed));
531 *out_range = {old_tail, new_tail};
References Distance(), m_Capacity, m_ConsumerPending, and m_ProducerCommited.
◆ WriteElements()
◆ ReadElements()
◆ Commit()
◆ Distance()
◆ m_ProducerPending
◆ m_ProducerCommited
◆ m_Padding0
◆ m_ConsumerPending
◆ m_ConsumerCommited
◆ m_Padding1
◆ m_Queue
◆ m_Capacity
◆ m_Padding2
The documentation for this class was generated from the following file: