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

Core thread pool implementation with work stealing and auto-scaling. More...

Include dependency graph for thread_pool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::thread::thread_pool
 A thread pool for concurrent execution of jobs using multiple worker threads. More...
 

Namespaces

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

Macros

#define KCENON_HAS_COMMON_EXECUTOR   0
 
#define KCENON_THREAD_INTERNAL_INCLUDE
 

Typedefs

using kcenon::thread::standard_queue
 Standard mutex-based unbounded queue.
 
using kcenon::thread::policy_lockfree_queue
 Lock-free unbounded queue.
 

Detailed Description

Core thread pool implementation with work stealing and auto-scaling.

// Create a thread pool with 4 workers
auto pool = std::make_shared<kcenon::thread::thread_pool>("my_pool", 4);
// Submit a task
pool->enqueue([] { std::cout << "Task executed\n"; });
// Submit a task with a result
auto future = pool->enqueue([] { return 42; });
int result = future.get();
// Graceful shutdown (waits for pending tasks)
pool->stop();
Core thread pool implementation with work stealing and auto-scaling.

Definition in file thread_pool.h.

Macro Definition Documentation

◆ KCENON_HAS_COMMON_EXECUTOR

#define KCENON_HAS_COMMON_EXECUTOR   0

Definition at line 60 of file thread_pool.h.

◆ KCENON_THREAD_INTERNAL_INCLUDE

#define KCENON_THREAD_INTERNAL_INCLUDE

Definition at line 825 of file thread_pool.h.