ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
thread_pool Struct Reference

Thread pool structure. More...

#include <include/ascii-chat/thread_pool.h>

Data Fields

char name [64]
 Pool name for debugging.
 
thread_pool_entry_t * threads
 Linked list of threads (sorted by stop_id)
 
mutex_t threads_mutex
 Mutex protecting thread list.
 
size_t thread_count
 Number of threads in pool.
 
bool is_work_queue_mode
 True if using work queue mode.
 
size_t num_workers
 Number of pre-created worker threads.
 
thread_pool_work_entry_t * work_queue
 Queue of pending work.
 
mutex_t work_queue_mutex
 Mutex protecting work queue.
 
cond_t work_available
 Condition variable for workers to wait on.
 
bool shutdown_requested
 Signal workers to exit.
 

Detailed Description

Thread pool structure.

Manages a collection of worker threads with ordered cleanup support. Thread-safe for concurrent spawn/stop operations.

Can operate in two modes:

  1. Long-lived threads mode (original): spawn() creates permanent threads
  2. Work queue mode (new): pre-created workers pull tasks from a queue

Definition at line 118 of file thread_pool.h.

Field Documentation

◆ is_work_queue_mode

bool thread_pool::is_work_queue_mode

True if using work queue mode.

Definition at line 125 of file thread_pool.h.

◆ name

char thread_pool::name[64]

Pool name for debugging.

Definition at line 119 of file thread_pool.h.

◆ num_workers

size_t thread_pool::num_workers

Number of pre-created worker threads.

Definition at line 126 of file thread_pool.h.

◆ shutdown_requested

bool thread_pool::shutdown_requested

Signal workers to exit.

Definition at line 130 of file thread_pool.h.

◆ thread_count

size_t thread_pool::thread_count

Number of threads in pool.

Definition at line 122 of file thread_pool.h.

◆ threads

thread_pool_entry_t* thread_pool::threads

Linked list of threads (sorted by stop_id)

Definition at line 120 of file thread_pool.h.

◆ threads_mutex

mutex_t thread_pool::threads_mutex

Mutex protecting thread list.

Definition at line 121 of file thread_pool.h.

◆ work_available

cond_t thread_pool::work_available

Condition variable for workers to wait on.

Definition at line 129 of file thread_pool.h.

◆ work_queue

thread_pool_work_entry_t* thread_pool::work_queue

Queue of pending work.

Definition at line 127 of file thread_pool.h.

◆ work_queue_mutex

mutex_t thread_pool::work_queue_mutex

Mutex protecting work queue.

Definition at line 128 of file thread_pool.h.


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