tf::Worker class | Taskflow QuickStart

# tf::Worker class
#include <taskflow/core/worker.hpp>

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.

## Public functions

auto id() const -> size_t
  queries the worker id associated with its parent executor
auto queue_size() const -> size_t
  queries the size of the queue (i.e., number of enqueued tasks to run) associated with the worker
auto queue_capacity() const -> size_t
  queries the current capacity of the queue
auto executor() -> Executor*
  acquires the associated executor
auto thread() -> std::thread&
  acquires the associated thread

## Function documentation

### size_t tf::Worker::id() const

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.

Tab / T to search, Esc to close
…

Search for symbols, directories, files, pages or modules. You can omit any prefix from the symbol or file path; adding a `:` or `/` suffix lists all members of given symbol or directory.

Use ↓ / ↑ to navigate through the list, Enter to go. Tab autocompletes common prefix, you can copy a link to the result using ⌘ L while ⌘ M produces a Markdown link.

Sorry, nothing was found.