![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Wrapper class around a queue, that provides the interface for work stealing.
Work stealing is when one thread pops a task from another thread's queue. In WorkStealingQueue tasks are popped from the front and stolen from the back.
| BaseQueue | - any class implementing a queue with push_front, push_back, pop_front, pop_back, empty, front and back methods. |
#include <WorkStealingQueue.h>
Public Member Functions | |
| void | push (DataType data) |
| Push new element to the beginning of the queue. More... | |
| bool | empty () const |
| Check if the queue is empty. More... | |
| bool | tryPop (DataType &res) |
| Try to pop a task from the beginning of the queue in a non-blocking way. More... | |
| bool | trySteal (DataType &res) |
| Try to pop a task from the end of the queue (this is what we call "stealing") in a non-blocking way. More... | |
|
inline |
Check if the queue is empty.
|
inline |
Push new element to the beginning of the queue.
| data | - new element |
|
inline |
Try to pop a task from the beginning of the queue in a non-blocking way.
| [out] | res | - reference to which the new task should be assigned |
|
inline |
Try to pop a task from the end of the queue (this is what we call "stealing") in a non-blocking way.
| [out] | res | - reference to which the new task should be assigned |