A lite thread pool library written for Rust.

Usage

Cargo.toml

toml [dependencies] poolite = "0.2.1" or toml [dependencies] poolite = { git = "https://github.com/biluohc/poolite",branch = "master", version = "0.2.1" }

Explain

Create a thread pool:

The following are optional:

Let thread pool to start run:

Add a task to the thread pool:

Example

```Rust extern crate poolite;

use std::time::Duration; use std::thread;

fn main() { let pool = poolite::Pool::new().run(); pool.spawn(Box::new(move || test(32)));

fn test(msg: i32) {
    println!("fib({})={}", msg, fib(msg));
}
fn fib(msg: i32) -> i32 {
    match msg {
        0...2 => 1,
        x => fib(x - 1) + fib(x - 2),
    }
}
thread::sleep(Duration::from_millis(2000)); //wait for pool 2000ms

} ```