threadman 0.1.0
Header-only C++23 managed threads, dynamic pools, futures, and executors
Loading...
Searching...
No Matches
Macros
config.hpp File Reference

Central feature-gate header for ThreadMan's optional integrations and tunable defaults. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define THREADMAN_PLATFORM_LINUX   0
 
#define THREADMAN_PLATFORM_APPLE   0
 
#define THREADMAN_PLATFORM_OTHER   1
 
#define THREADMAN_WITH_NLOHMANN_JSON   0
 
#define THREADMAN_WITH_PARCEL   0
 
#define THREADMAN_RECENT_TASKS_CAPACITY   256
 Per-pool recent-task ring-buffer capacity.
 
#define THREADMAN_DEFAULT_POOL_NAME   "tm::default"
 Name used by ThreadManager::default_pool().
 
#define THREADMAN_DEFAULT_SCALE_UP_WAIT_MS   50
 How long the oldest queued task is allowed to wait before forcing a scale-up (milliseconds).
 
#define THREADMAN_DEFAULT_IDLE_TIMEOUT_MS   30000
 Idle-timeout window: a non-core worker that sees no work for this long retires (milliseconds).
 
#define THREADMAN_DEFAULT_SCALE_UP_QUEUE_THRESHOLD   4
 Queue-depth threshold above which the housekeeper considers scaling up.
 
#define THREADMAN_DEFAULT_SCALE_CHECK_INTERVAL_MS   100
 Housekeeper tick interval / per-pool scale evaluation cadence (ms).
 
#define THREADMAN_DEFAULT_STUCK_TASK_THRESHOLD_MS   60000
 A task that has been Running longer than this is flagged as stuck (ms).
 
#define THREADMAN_DEFAULT_SUMMARY_INTERVAL_MS   1000
 Periodic ManagerSummary cadence — listener publish interval (ms).
 
#define THREADMAN_DEFAULT_FUTURE_WAIT_SCALE_UP_WAIT_MS   10
 FutureWaitPool scale-up wait window (ms).
 

Detailed Description

Central feature-gate header for ThreadMan's optional integrations and tunable defaults.

Optional integration gates resolve to 1 (enabled) or 0 (disabled). A macro predefined by the build system (CMake) or the consumer always wins; otherwise it is auto-detected via __has_include.

Supported gates:

Tunable defaults — every constant below can be redefined by the consumer before including <threadman/threadman.hpp> or overridden per-pool via ThreadPoolOptions. The defaults here are conservative and aim at general workloads.

Macro Definition Documentation

◆ THREADMAN_DEFAULT_FUTURE_WAIT_SCALE_UP_WAIT_MS

#define THREADMAN_DEFAULT_FUTURE_WAIT_SCALE_UP_WAIT_MS   10

FutureWaitPool scale-up wait window (ms).

Shorter than a CPU pool's: a worker blocked on std::future::get() is not doing useful work, so the wait pool adds capacity eagerly once it saturates.

◆ THREADMAN_DEFAULT_IDLE_TIMEOUT_MS

#define THREADMAN_DEFAULT_IDLE_TIMEOUT_MS   30000

Idle-timeout window: a non-core worker that sees no work for this long retires (milliseconds).

◆ THREADMAN_DEFAULT_POOL_NAME

#define THREADMAN_DEFAULT_POOL_NAME   "tm::default"

Name used by ThreadManager::default_pool().

◆ THREADMAN_DEFAULT_SCALE_CHECK_INTERVAL_MS

#define THREADMAN_DEFAULT_SCALE_CHECK_INTERVAL_MS   100

Housekeeper tick interval / per-pool scale evaluation cadence (ms).

◆ THREADMAN_DEFAULT_SCALE_UP_QUEUE_THRESHOLD

#define THREADMAN_DEFAULT_SCALE_UP_QUEUE_THRESHOLD   4

Queue-depth threshold above which the housekeeper considers scaling up.

◆ THREADMAN_DEFAULT_SCALE_UP_WAIT_MS

#define THREADMAN_DEFAULT_SCALE_UP_WAIT_MS   50

How long the oldest queued task is allowed to wait before forcing a scale-up (milliseconds).

◆ THREADMAN_DEFAULT_STUCK_TASK_THRESHOLD_MS

#define THREADMAN_DEFAULT_STUCK_TASK_THRESHOLD_MS   60000

A task that has been Running longer than this is flagged as stuck (ms).

◆ THREADMAN_DEFAULT_SUMMARY_INTERVAL_MS

#define THREADMAN_DEFAULT_SUMMARY_INTERVAL_MS   1000

Periodic ManagerSummary cadence — listener publish interval (ms).

◆ THREADMAN_PLATFORM_APPLE

#define THREADMAN_PLATFORM_APPLE   0

◆ THREADMAN_PLATFORM_LINUX

#define THREADMAN_PLATFORM_LINUX   0

◆ THREADMAN_PLATFORM_OTHER

#define THREADMAN_PLATFORM_OTHER   1

◆ THREADMAN_RECENT_TASKS_CAPACITY

#define THREADMAN_RECENT_TASKS_CAPACITY   256

Per-pool recent-task ring-buffer capacity.

The pool keeps a window of the most-recently-completed TaskHandles for snapshot_recent_tasks().

◆ THREADMAN_WITH_NLOHMANN_JSON

#define THREADMAN_WITH_NLOHMANN_JSON   0

◆ THREADMAN_WITH_PARCEL

#define THREADMAN_WITH_PARCEL   0