// Next line will block execution until all tasks already in queue finished.
  // Almost all what I need, but new tasks will not be started.
  taskPool.finish(true);
}

Are you sure TaskPool.finish isn't what you're looking for?

"Signals worker threads to terminate when the queue becomes empty."

It seems to me that worker threads will continue as long as the queue isn't empty. So if a task adds another task to the pool, some worker will process the newly enqueued task.

Reply via email to