Games Task Scheduler (GTS)
A multi-processor scheduling framework for games engines
|
A multi-producer, multi-consumer queue. Properties: More...
#include <QueueSPMC.h>
Inherits gts::AlignedAllocator< GTS_NO_SHARING_CACHE_LINE_SIZE >.
Public Types | |
using | value_type = T |
using | mutex_type = TMutex |
using | size_type = size_t |
using | allocator_type = TAllocator |
Public Member Functions | |
TicketQueueSPMC (size_t numQueues, allocator_type const &allocator=allocator_type()) | |
TicketQueueSPMC (size_t numQueues, size_type sizePow2, allocator_type const &allocator=allocator_type()) | |
TicketQueueSPMC (TicketQueueSPMC const &other) | |
TicketQueueSPMC (TicketQueueSPMC &&other) | |
TicketQueueSPMC & | operator= (TicketQueueSPMC const &other) |
TicketQueueSPMC & | operator= (TicketQueueSPMC &&other) |
bool | empty () const |
size_type | size () const |
size_type | capacity () const |
allocator_type | get_allocator () const |
void | reserve (size_type sizePow2) |
void | clear () |
bool | tryPush (size_type ticket, const value_type &val) |
bool | tryPush (size_type ticket, value_type &&val) |
bool | tryPop (size_type ticket, value_type &out) |
A multi-producer, multi-consumer queue. Properties:
T | The type stored in the container. |
TMutex | The mutex type that guards access to the container. |
TAllocator | The allocator used for T. |
TSize | The integral type used for the container size. |
gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::TicketQueueSPMC | ( | TicketQueueSPMC< T, TMutex, TAllocator > const & | other | ) |
Copy constructor.
gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::TicketQueueSPMC | ( | TicketQueueSPMC< T, TMutex, TAllocator > && | other | ) |
Move constructor.
TicketQueueSPMC< T, TMutex, TAllocator >::size_type gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::capacity |
void gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::clear |
Removes all elements from the queue.
bool gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::empty |
TicketQueueSPMC< T, TMutex, TAllocator >::allocator_type gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::get_allocator |
TicketQueueSPMC< T, TMutex, TAllocator > & gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::operator= | ( | TicketQueueSPMC< T, TMutex, TAllocator > && | other | ) |
Move assignment.
TicketQueueSPMC< T, TMutex, TAllocator > & gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::operator= | ( | TicketQueueSPMC< T, TMutex, TAllocator > const & | other | ) |
Copy assignment.
void gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::reserve | ( | size_type | sizePow2 | ) |
Increases the capacity of the queue. Does nothing if 'sizePow2' < capacity.
TicketQueueSPMC< T, TMutex, TAllocator >::size_type gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::size |
bool gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::tryPop | ( | size_type | ticket, |
value_type & | out | ||
) |
Pops an element from the queue and copies it into 'out'.
bool gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::tryPush | ( | size_type | ticket, |
const value_type & | val | ||
) |
Copies 'val' into the queue.
bool gts::internal::TicketQueueSPMC< T, TMutex, TAllocator >::tryPush | ( | size_type | ticket, |
value_type && | val | ||
) |
Moves 'val' into the queue.