rust-waitgroup 0.1.0

A Golang like WaitGroup
Documentation
  • Coverage
  • 83.33%
    5 out of 6 items documented1 out of 5 items with examples
  • Size
  • Source code size: 39.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.29 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • nnsgmsone/rust-waitgroup
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nnsgmsone

rust-waitgroup

rust-waitgroup is a lightweight synchronization primitive for managing concurrency in Rust programs, inspired by the waitgroup from Go.

Features

  • Synchronization: Efficiently waits for a collection of threads (or tasks) to complete before proceeding.
  • Lightweight: Minimal overhead with simple API for adding tasks and waiting on their completion.
  • Thread Safety: Ensures thread safety for synchronization across multiple threads.

Getting Started

use rust_waitgroup::WaitGroup;
use std::thread;

let wg = WaitGroup::default();
let n = 10;
for _ in 0..n {
    let wg = wg.clone();
    wg.add(1);
    thread::spawn(move || {
         // do some work
         wg.done();
    });
}
wg.wait();

License

rust-waitgroup source code is available under the GPL License.