Releases: abin-z/ThreadPool
Releases · abin-z/ThreadPool
v0.9.2
✨ Release v0.9.2 - A Lightweight and Flexible C++11 Thread Pool
English
This is the first public release of abin/threadpool, a lightweight, cross-platform, and easy-to-use C++11 thread pool library.
✨ Features
- Submit any callable with parameters and retrieve return values via
std::future - Thread-safe with proper synchronization using
std::mutex,std::condition_variable, and atomics - Two shutdown modes:
WaitForAllTasks: Waits for all tasks (pending and running) to finishDiscardPendingTasks: Cancels pending tasks but finishes running ones
- Simple API, no external dependencies
- Support for thread pool restart with custom thread count
- Detailed status info: total, busy, idle threads, pending tasks
- Tested on both Linux and Windows
🔧 Default thread count is set to std::thread::hardware_concurrency(), fallback is 4. Maximum allowed threads: 4096.
中文
这是 abin/threadpool 的首个公开版本发布,一个轻量级、跨平台、易用的 C++11 线程池库。
✨ 特性亮点
- 支持提交任意参数的任务,并通过
std::future获取返回值 - 线程安全,使用
std::mutex、std::condition_variable以及原子变量同步 - 两种关闭模式:
WaitForAllTasks:等待所有任务(运行中和未运行)完成DiscardPendingTasks:丢弃尚未开始的任务,已运行的继续执行
- API 简洁明了,无需外部依赖
- 支持线程池重启,可指定新线程数量
- 状态查询接口,可获取线程池实时状态信息(总线程、忙线程、空闲线程、排队任务数)
- 已在 Linux 与 Windows 上测试通过
🔧 默认线程数为系统支持的并发数(std::thread::hardware_concurrency()),最小 1,最大支持 4096 个线程。
✅ MIT License
📁 Examples and documentation: See README