Le 25/04/13 17:42, Dan Lincan a écrit :
Hello,
You can find my proposal for the thread_pool Project at [1]. Please tell me how I can improve it and where to give more details, further explanations. I have avoided giving implementation details and focused on sketching the interface.
I have some questions: * Why the submit function of all the thread pools doesn't returns the same? * What is the advantage of returning future from submit call? * Would the destructor of the future resulting of the submit call wait until the task has been finished? * What about having a specific time based pool that will submit the function to another pool once the duration/time_point has elapsed/reached? Or specific free functions submit_after/submit_at that use a hidden thread/queue to manage with the time constraint? * I would provide a submit function that has as parameter the function to call and its parameters, as std::async, std::thread::thread, or std::packaged_task provide, so that the user is not forced to use bind. * I would move the time argument as the fist one of the time based functions so that the preceding point can be made possible for these functions also. * For a work-stealing thread pool the user would need a function to force the scheduling of new jobs when it needs to wait for some jobs to finish. * I don't see nothing about cancellation of submitted functions. Could you comment on this? * From the interface all the pools are non-blocking, that is the queue are not bounded. Have you some thought about thread pool that have bounded queues and that could block or tell the user that the queues are congested, ... * Quite frequent we need to submit jobs that need to be handled in a sequential order, what do you propose for this use case? * In addition to submitting a job after/at a given duration/time_point have been elapsed/reached, we often need to submit a job that needs the result of another job. How a user would be able to do it. Would the library help her/him? * It would be great to reference existing libraries/proposals and how your proposal solves limitations you can find in the referenced libraries. * How these thread pool can be used with un updated async function that use thread pools? Best, Vicente