Dispatch Queue
Dispatch Queue / Thread Pool implementation for C++11 with built-in C++20 coroutine support
 
Loading...
Searching...
No Matches
dispatch_queue Namespace Reference

Namespaces

namespace  detail
 

Classes

class  dispatch_queue
 
class  task
 
class  task_error
 

Typedefs

using task_tag = int
 

Enumerations

enum class  task_state { invalid , pending , ready , failed }
 

Functions

template<typename T>
task< void > when_all (std::initializer_list< task< T > > tasks)
 
template<typename TaskRange>
task< void > when_all (const TaskRange &tasks)
 
template<typename T>
task< void > when_any (std::initializer_list< task< T > > tasks)
 
template<typename TaskRange>
task< void > when_any (const TaskRange &tasks)
 

Typedef Documentation

◆ task_tag

Tags used by dispatch_queue::dispatch_tagged. Tasks tagged with the same value never run in parallel: at most one task is processed for each tag at a time.

Enumeration Type Documentation

◆ task_state

enum class dispatch_queue::task_state
strong

Current state of a task.

See also
task
Enumerator
invalid 

Task was created without a future and is invalid.

pending 

Task is either queued for execution or still running.

ready 

Task finished successfully and the result value is readily available.

failed 

Task failed with an exception.

Function Documentation

◆ when_all() [1/2]

template<typename TaskRange>
task< void > dispatch_queue::when_all ( const TaskRange & tasks)

Create a task that finishes whenever all given tasks finish.

If any subtask fails, this task fail with a task_error. Otherwise, it succeeds.

◆ when_all() [2/2]

template<typename T>
task< void > dispatch_queue::when_all ( std::initializer_list< task< T > > tasks)

Create a task that finishes whenever all given tasks finish.

If any subtask fails, this task fail with a task_error. Otherwise, it succeeds.

◆ when_any() [1/2]

template<typename TaskRange>
task< void > dispatch_queue::when_any ( const TaskRange & tasks)

Create a task that finishes whenever any of the given tasks finish.

If the first finishing task fails, this task fails with the same exception. Otherwise, it succeeds.

◆ when_any() [2/2]

template<typename T>
task< void > dispatch_queue::when_any ( std::initializer_list< task< T > > tasks)

Create a task that finishes whenever any of the given tasks finish.

If the first finishing task fails, this task fails with the same exception. Otherwise, it succeeds.