ThreadPool
ThreadPool copied to clipboard
Should ThreadPool provide a function which waits until all thread finish?
Dear developer:
I want to add shutdown
function that waits until all worker finish. Because I found ThreadPool will deconstructing directly if process exit. I think user have right to choose terminate ThreadPool or wait for finishing.
Are you agree with me? If you do I can submit a PR. Have a good day!
I have forked and modified this ThreadPool for use in log4cplus where I have implemented this functionality. See https://github.com/log4cplus/Threadpool.
I believe the aim of this repository is to provide a starting point thread pool rather than a complete implementation with many features.
That's great! Learning new things from you.
On Fri, Aug 10, 2018 at 6:09 PM Václav Haisman [email protected] wrote:
I have forked and modified this ThreadPool for use in log4cplus where I have implemented this functionality. See https://github.com/log4cplus/Threadpool.
I believe the aim of this repository is to provide a starting point thread pool rather than a complete implementation with many features.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/progschj/ThreadPool/issues/59#issuecomment-412039788, or mute the thread https://github.com/notifications/unsubscribe-auth/ABaKcT5QBOs2fNM4r6pxXtRbT77yMNLwks5uPVvugaJpZM4V36Ve .
-- One of my most productive days was throwing away 1000 lines of code.
I have forked and modified this ThreadPool for use in log4cplus where I have implemented this functionality. See https://github.com/log4cplus/Threadpool.
I believe the aim of this repository is to provide a starting point thread pool rather than a complete implementation with many features.
excellent job, man. I get the help in 2022 from you in 2018, maybe that is the charm of Internet.
@wilx Could you please add some bit example or comment to understand the usage of pool.wait_until_empty(); pool.wait_until_nothing_in_flight();
When you are destroying the object that owns the thread pool, you have to wait until the queue is empty and there are no threads running with the queued items. E.g.,
https://github.com/log4cplus/log4cplus/blob/4cd02bb7c513f9ae098ab34bccdaa57340e4531c/src/global-init.cxx#L388-L393