objpool 0.2.0

Thread-safe generic object pool
Documentation
  • Coverage
  • 12.5%
    1 out of 8 items documented1 out of 8 items with examples
  • Size
  • Source code size: 11.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 699.64 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Documentation
  • btmorex/objpool
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • btmorex

objpool

Thread-safe generic object pool

Build Status Coverage Status

Examples

use objpool::Pool;
use std::thread;

let pool = Pool::with_capacity(5, || 0);
let mut handles = Vec::new();
for _ in 0..10 {
    let pool = pool.clone();
    handles.push(thread::spawn(move || {
        for _ in 0..1000 {
            *pool.get() += 1;
        }
    }));
}

for handle in handles {
    handle.join().unwrap();
}
assert_eq!(*pool.get() + *pool.get() + *pool.get() + *pool.get() + *pool.get(), 10000);