title: Wait for tasks to get completed in threadpool
body: <p>I have created a thread pool in C++ which stores all tasks in a queue. Thread pool start n number of threads which takes tasks from queue , process each task and then delete tasks from queue.</p>
  
  <p>Now , I want to wait till all tasks get completed. Checking for empty queue for completion of tasks may not work as , task can be given to each thread and queue can be emptied but still the tasks can in processing mode.</p>
  
  <p>I am not getting idea how to wait for all the tasks completion.This is a design problem. Any suggestions?</p>