| Taskflow: A General-purpose Task-parallel Programming System

Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
tf::Worker Class Reference

class to create a worker in an executor More...

`#include <taskflow/core/worker.hpp>`

## Public Member Functions
size_t | id () const
| queries the worker id associated with its parent executor
size_t | queue_size () const
| queries the size of the queue (i.e., number of enqueued tasks to run) associated with the worker
size_t | queue_capacity () const
| queries the current capacity of the queue
std::thread & | thread ()
| acquires the associated thread

## Friends
class | Executor
class | Runtime
class | WorkerView

## Detailed Description

class to create a worker in an executor

The class is primarily used by the executor to perform work-stealing algorithm. Users can access a worker object and alter its property (e.g., changing the thread affinity in a POSIX-like system) using tf::WorkerInterface.

## Member Function Documentation

## ◆ id()

size_t tf::Worker::id | ( |  | ) | const
| inline

queries the worker id associated with its parent executor

A worker id is a unsigned integer in the range `[0, N)`, where `N` is the number of workers spawned at the construction time of the executor.

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

- taskflow/core/worker.hpp