tf::UnboundedTaskQueue
taskflow/core/tsq.hpp
tf::UnboundedTaskQueue::Array
typename T
std::atomic< int64_t > std::atomic<int64_t> tf::UnboundedTaskQueue< T >::_top _top
std::atomic< int64_t > std::atomic<int64_t> tf::UnboundedTaskQueue< T >::_bottom _bottom
std::atomic< Array * > std::atomic<Array*> tf::UnboundedTaskQueue< T >::_array _array
std::vector< Array * > std::vector<Array*> tf::UnboundedTaskQueue< T >::_garbage _garbage
tf::UnboundedTaskQueue< T >::UnboundedTaskQueue
(int64_t LogSize=TF_DEFAULT_UNBOUNDED_TASK_QUEUE_LOG_SIZE)
UnboundedTaskQueue
int64_t LogSize TF_DEFAULT_UNBOUNDED_TASK_QUEUE_LOG_SIZE

constructs the queue with the given size in the base-2 logarithm

LogSize

the base-2 logarithm of the queue size

tf::UnboundedTaskQueue< T >::~UnboundedTaskQueue
()
~UnboundedTaskQueue

destructs the queue

bool bool tf::UnboundedTaskQueue< T >::empty () const noexcept empty

queries if the queue is empty at the time of this call

size_t size_t tf::UnboundedTaskQueue< T >::size () const noexcept size

queries the number of items at the time of this call

int64_t int64_t tf::UnboundedTaskQueue< T >::capacity () const noexcept capacity

queries the capacity of the queue

void void tf::UnboundedTaskQueue< T >::push (T item) push T item

inserts an item to the queue

item

the item to push to the queue

Only the owner thread can insert an item to the queue. The operation can trigger the queue to resize its capacity if more space is required.
T T tf::UnboundedTaskQueue< T >::pop () pop

pops out an item from the queue

Only the owner thread can pop out an item from the queue. The return can be a `nullptr` if this operation failed (empty queue).

T T tf::UnboundedTaskQueue< T >::steal () steal

steals an item from the queue

Any threads can try to steal an item from the queue. The return can be a `nullptr` if this operation failed (not necessary empty).

Array * UnboundedTaskQueue< T >::Array * tf::UnboundedTaskQueue< T >::resize_array (Array *a, int64_t b, int64_t t) resize_array Array * a int64_t b int64_t t

class to create a lock-free unbounded single-producer multiple-consumer queue

T

data type (must be a pointer type)

This class implements the work-stealing queue described in the paper, Correct and Efficient Work-Stealing for Weak Memory Models.

Only the queue owner can perform pop and push operations, while others can steal data from the queue simultaneously.

- tf::UnboundedTaskQueue
  _array
- tf::UnboundedTaskQueue
  _bottom
- tf::UnboundedTaskQueue
  _garbage
- tf::UnboundedTaskQueue
  _top
- tf::UnboundedTaskQueue
  capacity
- tf::UnboundedTaskQueue
  empty
- tf::UnboundedTaskQueue
  pop
- tf::UnboundedTaskQueue
  push
- tf::UnboundedTaskQueue
  resize_array
- tf::UnboundedTaskQueue
  size
- tf::UnboundedTaskQueue
  steal
- tf::UnboundedTaskQueue
  UnboundedTaskQueue
- tf::UnboundedTaskQueue
  ~UnboundedTaskQueue