quickpool  0.2.0
An easy-to-use, header-only work stealing thread pool in C++11
Public Member Functions | List of all members
quickpool::TodoList Class Reference

Todo list - a synchronization primitive. More...

#include <quickpool.hpp>

Public Member Functions

 TodoList (size_t num_tasks=0) noexcept
 
void add (size_t num_tasks=1) noexcept
 
void cross (size_t num_tasks=1)
 
bool empty () const noexcept
 checks whether list is empty.
 
void wait (size_t millis=0)
 
void stop (std::exception_ptr eptr=nullptr) noexcept
 

Detailed Description

Todo list - a synchronization primitive.

Add a task with add(), cross it off with cross(), and wait for all tasks to complete with wait().

Definition at line 36 of file quickpool.hpp.

Constructor & Destructor Documentation

◆ TodoList()

quickpool::TodoList::TodoList ( size_t  num_tasks = 0)
inlinenoexcept

constructs the todo list.

Parameters
num_tasksinitial number of tasks.

Definition at line 41 of file quickpool.hpp.

Member Function Documentation

◆ add()

void quickpool::TodoList::add ( size_t  num_tasks = 1)
inlinenoexcept

adds tasks to the list.

Parameters
num_tasksadd that many tasks to the list.

Definition at line 47 of file quickpool.hpp.

◆ cross()

void quickpool::TodoList::cross ( size_t  num_tasks = 1)
inline

crosses tasks from the list.

Parameters
num_taskscross that many tasks to the list.

Definition at line 51 of file quickpool.hpp.

◆ stop()

void quickpool::TodoList::stop ( std::exception_ptr  eptr = nullptr)
inlinenoexcept

stops the list; it will forever look empty from now on.

Parameters
eptr(optional) pointer to an active exception to be rethrown by a waiting thread; typically retrieved from std::current_exception().

Definition at line 85 of file quickpool.hpp.

◆ wait()

void quickpool::TodoList::wait ( size_t  millis = 0)
inline

waits for the list to be empty.

Parameters
millisif > 0; waiting aborts after waiting that many milliseconds.

Definition at line 68 of file quickpool.hpp.


The documentation for this class was generated from the following file: