progschj / ThreadPool

A simple C++11 Thread Pool implementation
zlib License
7.64k stars 2.21k forks source link

Set max size of the queue. #12

Closed EasonLiao closed 10 years ago

EasonLiao commented 10 years ago

Using semaphore to set the max size of the task queue to avoid the size of task queue growing infinitely. Once the size of queue reach the limit, the enqueue function will be blocked.

EasonLiao commented 10 years ago

Thanks for suggestion, I've changed the code as you suggested. And sorry for my poor understanding of parallel programming. :)

progschj commented 10 years ago

I probably won't merge this request but encourage forks that have additional features. I always like seeing variations based on it. The main purpose of this repository is to provide a base case implementation that is intentionally free of features that are not universally required.