ThreadPool
ThreadPool copied to clipboard
Add a variable to control the tasks size
A program may accepts many tasks at the same time, it will grow the memory to use. If the memory is taken a lot by the program, the system will kill the program. May the library add a variable to control the max tasks can be added to the std::queue? Thanks.
-
// the task queue -
std::queue< std::function<void()> > tasks;
What should happen when the maximum is reached? Throw an exception or block until a task has finished?