#include <job_queue.hpp>
Definition at line 378 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 420 of file job_queue.hpp.
422 return PushImpl<true>(elements, num_elements) != 0u;
◆ PushUpTo()
Definition at line 425 of file job_queue.hpp.
427 return PushImpl<false>(elements, num_elements);
◆ PopExact()
Definition at line 430 of file job_queue.hpp.
432 return PopImpl<true>(out_elements, num_elements) != 0u;
◆ PopUpTo()
Definition at line 435 of file job_queue.hpp.
437 return PopImpl<false>(out_elements, num_elements);
◆ PushImpl()
template<bool allOrNothing>
Definition at line 442 of file job_queue.hpp.
445 if (RequestWriteRange<allOrNothing>(&range, num_elements))
449 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 470 of file job_queue.hpp.
480 if constexpr (allOrNothing)
482 if (capacity_left < num_items)
488 if (capacity_left == 0)
493 const size_type num_element_to_write = capacity_left < num_items ? capacity_left : num_items;
495 new_head = old_head + num_element_to_write;
497 }
while (!
m_ProducerPending.compare_exchange_weak(old_head, new_head, std::memory_order_relaxed, std::memory_order_relaxed));
499 *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 504 of file job_queue.hpp.
514 size_t capacity_left = (
m_Capacity - distance);
515 if constexpr (allOrNothing)
517 if (capacity_left < num_items)
528 const size_type num_element_to_read = capacity_left < num_items ? capacity_left : num_items;
530 new_tail = old_tail + num_element_to_read;
532 }
while (!
m_ConsumerPending.compare_exchange_weak(old_tail, new_tail, std::memory_order_relaxed, std::memory_order_relaxed));
534 *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: