using wait_for_active_tasks

Help
dfermin315
2012-09-16
2013-04-17
  • dfermin315
    dfermin315
    2012-09-16

    Hello.

    I'm new to threadpool so I apologize if this is a silly quesiton.
    I would like to specify that my shutdown policy should be "wait for completion of all active tasks and worker termination"
    I'm not sure how to specify this in my code.

    Currently I do:

    boost::threadpool::thread_pool TP(8); // 8 threads
    for(int i = 0; i < 1000; i++) TP.schedule( someFunction(), i );
    TP.wait();

    This seems to "hang" for a long time at the last job.
    I think I need to change my scheduling policy (correct me if I'm wrong).

    Can anyone provide me an example of how you call the "wait_for_active_tasks" class?

    Thanks,