[−][src]Crate blackhole
Blackhole
...to throw your threads into.
Project
- Repository: https://bitbucket.org/haibison/blackhole-rs
- License: Free Public License 1.0.0
- This project follows Semantic Versioning 2.0.0
Features
- Simple thread manager.
- Threads' panics are printed to stderr.
Design
It uses a channel and 2 threads:
- Manager: holds jobs in a queue.
- Runner: constantly contacts manager to ask for new jobs to run.
Examples
use blackhole::Blackhole; // Active limit accepts Into<u64>, so you can define it in smaller integers, for safety purpose. let active_limit: u8 = 4; let queue_limit: usize = usize::from(active_limit) * 2 + 2; let blackhole = Blackhole::new(active_limit, queue_limit).unwrap(); for i in 0 .. queue_limit * 2 { blackhole.throw(move || { println!("i = {:02}", i); }); } blackhole.escape_on_idle().unwrap();
Macros
get_online_processors | Gets online processors |
Structs
Blackhole | Blackhole |
Constants
CODE_NAME | Crate code name |
NAME | Crate name |
RELEASE_DATE | Crate release date (year/month/day) |
TAG | Tag, which can be used for logging... |
UUID | Unique universally identifier of this crate |
VERSION | Crate version |