Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thread Pool

This project is a C++ workspace for exploring thread-pool design through hands-on practice, with implementations that are clean, structured, and useful for both learning and practical work.

It includes:

  • a simple single-queue thread pool
  • an advanced multi-queue thread pool

The code is easy to study and learn from, while also being structured in a way that feels practical, maintainable, and suitable for real-world use.

What this project demonstrates

This repository shows how to:

  • create and manage worker threads
  • submit work items to a task queue
  • coordinate execution safely with standard C++ primitives
  • build a small but realistic concurrency abstraction
  • organize a CMake-based project with separate libraries and tests

Project structure

How it works

The simple pool uses a shared task queue and a set of worker threads. When do_work is called, the task is placed in the queue and a worker thread executes it. The advanced pool uses several internal task queues and distributes work across them to reduce contention. In both cases, the pool is designed to shut down cleanly and to behave predictably under normal use.

Build and run

From the project root, configure and build the project with:

cmake -S . -B build
cmake --build build

To run the example program:

./build/thread_pool_tester

On Windows, the executable may be named thread_pool_tester.exe depending on your generator.

Tests

The project includes tests for both implementations. You can run the full test suite with:

ctest --test-dir build -VV

You can also run the individual test binaries directly from the build tree if needed.

Notes

This repository is primarily a learning project, but it is also written and structured in a way that reflects careful engineering habits and can be a useful reference for future work.

About

Thread pool implementation in C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages