An implementation of a thread pool that is similar to ThreadPoolExecutor
in java.
Install this library using cargo
,
cargo add jtp
Or add this to your Cargo.toml
:
[dependencies]
jtp = "0.1.1"
And use this library:
```rust // Creates a thread pool. let threadpool = ThreadPoolBuilder::default() .corepoolsize(6) // Sets the number of core threads. .maxpoolsize(10) // Sets the maximum number of threads. .channelcapacity(100) // Sets the capacity of the task queue. .rejectedhaskhandler(RejectedTaskHandler::Abort) .build() .unwrap();
threadpool.execute(|| println!("Hello World")); threadpool.wait(); ```
Apache License, Version 2.0, LICENSE-APACHE