ThreadPool icon indicating copy to clipboard operation
ThreadPool copied to clipboard

Add a variable to control the tasks size

Open MatthewButterfly opened this issue 8 years ago • 1 comments

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.

  1. // the task queue
    
  2. std::queue< std::function<void()> > tasks;
    

MatthewButterfly avatar Aug 24 '17 08:08 MatthewButterfly

What should happen when the maximum is reached? Throw an exception or block until a task has finished?

jhasse avatar Apr 18 '18 11:04 jhasse