Taskium is a modern C++ thread pool framework designed to manage concurrent task execution. It features lock-based scheduling, mutex-guarded queues, and condition-variable signaling to ensure safe, efficient task dispatch across multiple worker threads.
- Lock-based thread pool using mutexes and condition variables.
- RAII-managed worker lifecycles to ensure safe thread joins and clean shutdowns.
- Concurrent task dispatch: Supports submitting arbitrary tasks (e.g., lambdas, function objects).
- Thread-safe logging with log levels (
INFO,ERROR,RESULT) for clean output.
- Install CMake (if not already installed)
# macOS
brew install cmake
# Ubuntu/Debian
sudo apt install cmake- Clone the repository:
git clone https://github.com/your-username/taskium.git
cd taskium- Build with CMake:
mkdir build
cd build
cmake ..
makeAn example program demonstrates Taskium’s thread pool by running a Monte Carlo Pi estimation workload across multiple threads.
Use the interactive script:
./run_monte_carlo.shThe script will:
- Detect your system’s hardware concurrency.
- Prompt for the number of threads and points per thread.
- Submit tasks to the thread pool and run them concurrently.
[INFO] starting pi estimation with 12 threads and 12412 points per thread
[INFO] submitted pi estimation task 0
[INFO] [THREAD 0x16d717000] task 0 started
...
[INFO] [THREAD 0x16d717000] task 11 completed
[RESULT] estimated pi = 3.143007