Comments (4)
Hi @jeprojects
Yes the most generic way is to use this code:
let pool = Builder::new().build()
// ... spawn all the work with pool.execute(...)
// here you don't need the pool anymore
pool.join();
drop(pool);
Does this answer your question?
Cheers,
Stefan
from rust-threadpool.
If the pool was in the middle of a task, wouldn't that force close the thread?
from rust-threadpool.
No because the pool.join()
awaits the the last tasks finish.
Then once the pool gets dropped the workers receive a signal and terminate themselves.
from rust-threadpool.
I hope, I answered you question.
If not, feel free to reopen this or a new issue.
Cheers,
Stefan
from rust-threadpool.
Related Issues (20)
- Limit job-pool size HOT 5
- Why not remove trait FnBox ? HOT 1
- Possible memory leak HOT 2
- Question on panicking threads HOT 3
- v2.0 status? HOT 3
- The unit test ```test_shrink``` make no sense HOT 2
- Intermittent failure in `test_multi_join()` HOT 1
- API breaking changes proposal HOT 5
- Mention rayon's threadpool in 'similar libraries' section
- [libz blitz] Missing categories and keywords in Cargo.toml
- [libz blitz] Missing hyperlinks in documentation
- libz bliz tracking issues HOT 2
- Default number of workers: Look at the affinity mask instead of the number of CPUs? HOT 2
- Documentation? HOT 1
- Feature: split thread pool from work queue HOT 1
- Use sync_channel to limit the size of job queue? HOT 3
- SYNC is not implemented for ThreadPool HOT 5
- Feature: provide a way to shutdown the thread pool HOT 3
- Hardcoded constant in example HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-threadpool.