Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
thread_worker.cpp File Reference

Implementation of worker thread for thread pool execution. More...

Include dependency graph for thread_worker.cpp:

Go to the source code of this file.

Namespaces

namespace  kcenon
 
namespace  kcenon::thread
 Core threading foundation of the thread system library.
 

Detailed Description

Implementation of worker thread for thread pool execution.

This file contains the implementation of the thread_worker class, which represents individual worker threads within a thread pool. Each worker thread continuously processes jobs from a shared job queue until the thread pool is shut down.

Key Features:

  • Continuous job processing from shared queue
  • Optional performance timing and logging
  • Graceful shutdown handling
  • Error propagation and logging
  • Job queue association management

Worker Lifecycle:

  1. Worker is created and associated with a job queue
  2. Worker thread starts and enters continuous work loop
  3. Worker dequeues and executes jobs until queue is empty/stopped
  4. Worker logs execution results and timing information
  5. Worker shuts down gracefully when work is complete

Performance Characteristics:

  • Low latency job pickup (typically <1µs)
  • Efficient queue polling with minimal CPU overhead
  • Optional timing measurements for performance analysis

Definition in file thread_worker.cpp.