co_ecs 0.9.0
Cobalt ECS
Loading...
Searching...
No Matches
co_ecs::thread_pool::worker Class Reference

Thread pool worker. More...

#include <thread_pool.hpp>

Public Member Functions

 worker (thread_pool &pool, uint16_t id)
 Create a thread pool worker.
 
std::size_t id () const noexcept
 Return ID of the worker.
 
task_tsubmit (auto &&func, task_t *parent=nullptr)
 Submit a task into local workers queue.
 
void submit (task_t *task)
 Submit a task into local workers queue.
 
void wait (task_t *task)
 Wait for task completion.
 

Static Public Member Functions

static workercurrent () noexcept
 Get current thread worker.
 

Friends

class thread_pool
 

Detailed Description

Thread pool worker.

Constructor & Destructor Documentation

◆ worker()

co_ecs::thread_pool::worker::worker ( thread_pool & pool,
uint16_t id )
inline

Create a thread pool worker.

Parameters
pool
id

Member Function Documentation

◆ current()

static worker & co_ecs::thread_pool::worker::current ( )
inlinestaticnoexcept

Get current thread worker.

Returns
Returns a worker dedicated to the thread this method is invoked from

◆ id()

std::size_t co_ecs::thread_pool::worker::id ( ) const
inlinenoexcept

Return ID of the worker.

Returns
Worker ID

◆ submit() [1/2]

task_t * co_ecs::thread_pool::worker::submit ( auto && func,
task_t * parent = nullptr )
inline

Submit a task into local workers queue.

Parameters
funcFunction
parentParent task pointer

◆ submit() [2/2]

void co_ecs::thread_pool::worker::submit ( task_t * task)
inline

Submit a task into local workers queue.

Parameters
taskTask

◆ wait()

void co_ecs::thread_pool::worker::wait ( task_t * task)
inline

Wait for task completion.

Parameters
taskTask

Friends And Related Symbol Documentation

◆ thread_pool

friend class thread_pool
friend

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