#include <ppqsort/parallel/cpp/task_stack.h>
template<typename taskType = std::function<void()>>
TaskStack class
Constructors, destructors, conversion operators
Public functions
- auto try_push(taskType&& task) -> bool
- Try to push a task to the stack.
- void push(taskType&& task)
- Push a task to the stack. If the stack is held by another thread, wait until it is released.
- auto try_pop() -> std::optional<taskType>
- Try to pop a task from the stack.
- auto pop() -> std::optional<taskType>
- Pop a task from the stack. If the stack is held by another thread, wait until it is released.
Function documentation
template<typename taskType>
bool ppqsort:: impl:: cpp:: TaskStack<taskType>:: try_push(taskType&& task)
Try to push a task to the stack.
Parameters | |
---|---|
task | |
Returns | true if the task was successfully pushed, false otherwise (stack is held by other thread). |
template<typename taskType>
void ppqsort:: impl:: cpp:: TaskStack<taskType>:: push(taskType&& task)
Push a task to the stack. If the stack is held by another thread, wait until it is released.
Parameters | |
---|---|
task |
template<typename taskType>
std::optional<taskType> ppqsort:: impl:: cpp:: TaskStack<taskType>:: try_pop()
Try to pop a task from the stack.
Returns | std::nullopt if the stack is empty or held by another thread, task otherwise. |
---|
template<typename taskType>
std::optional<taskType> ppqsort:: impl:: cpp:: TaskStack<taskType>:: pop()
Pop a task from the stack. If the stack is held by another thread, wait until it is released.
Returns | std::nullopt if the stack is empty, task otherwise. |
---|