foofighters 0.1.0

A lightweight, work-stealing thread pool.
Documentation
# foofighters

A lightweight, work-stealing thread pool.

[![Crates.io](https://img.shields.io/crates/v/foofighters.svg)](https://crates.io/crates/foofighters)
[![Docs.rs](https://docs.rs/foofighters/badge.svg)](https://docs.rs/foofighters)

## Example

Add this crate using `cargo add foofighters`:

```rust
use foofighters::pool::PoolBuilder;

let pool = PoolBuilder::new()
    .set_worker_count(4)
    .set_steal_amount(2)
    .build();

let submission = pool.spawn(|| {
    println!("Hello from a worker!");
});

submission.into_result().unwrap();
```

## Lifecycle

Each worker thread runs this cycle:

1.  Execute all tasks in its local queue.
2.  Steal from the global queue if empty.
3.  Attempt to steal batches from other workers.
4.  Park when no work remains (and unpark when new tasks arrive).
5.  On shutdown, drain any remaining global tasks before exiting.

## Shutdown

When the `Pool` instance is dropped:

- Task submissions are automatically blocked.
- All worker threads are unparked.
- Each worker drains any remaining global tasks.
- The pool joins all threads before returning control.

## Tests

```bash
cargo test
```

Or just check compilation without running them as running it will spawn threads:

```bash
cargo test --doc --no-run
```

## License

**MIT**