-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reuse thread pool after calling stop(true) ? #7
Comments
I have the same question. Or to rephrase it: |
From reading over the source, the simplest fix would be to add a
This effectively emulates the behavior of the constructor:
Which would allow you to restart the pool by effectively rebuilding the threads. While I feel this would work, it would be a cheap fix to the underlying problem. In a more ideal implementation the |
Does it delete and create all threads again? |
The bit of code I provided is the naive approach to solving the problem. It would wind up having to delete and rebuild the threads. See the last paragraph of my original comment. A better solution would be a system that that can pause work on all of the threads and only kill the ones you that are needed. The issue isn't with the functionality of stop(). The issue is what it is being used for. It is being used before calling resize() to allow safe resizing of the pool. It would be better to have another function that could pause work or have resize be written in a way that it can resize without having to stop work at all. |
Hi,
If I try to reuse the thread pool (using push) after calling stop(true), it doesn't create any new threads ? Something like the following sequence:
Is this behavior intentional ? I have gotten around this by destroying the old pool and creating a new pool but that does not seem efficient.
The text was updated successfully, but these errors were encountered: