jtp

Crates.iojtp
lib.rsjtp
version0.1.3
sourcesrc
created_at2023-03-08 15:27:56.651788
updated_at2024-03-07 08:59:01.294049
descriptionA simple implementation of thread pool, similar to the ThreadPoolExecutor in java.
homepagehttps://github.com/nano-go/jtp
repositoryhttps://github.com/nano-go/jtp
max_upload_size
id804714
size39,953
Nano1 (nano-go)

documentation

README

JTP

An implementation of a thread pool that is similar to ThreadPoolExecutor in java.

Usage

Install this library using cargo,

cargo add jtp

Or add this to your Cargo.toml:

[dependencies]
jtp = "0.1.3"

And use this library:

// Creates a thread pool.
let thread_pool = ThreadPoolBuilder::default()
	.core_pool_size(6) // Sets the number of core threads.
	.max_pool_size(10) // Sets the maximum number of threads.
	.channel_capacity(100) // Sets the capacity of the task queue.
	.rejected_handler(RejectedTaskHandler::Abort)
	.build();

thread_pool.execute(|| println!("Hello World"));
thread_pool.wait();

License

Apache License, Version 2.0, LICENSE-APACHE

Commit count: 6

cargo fmt