thread-counter
A lightweight, thread-safe library for counting and synchronizing concurrent operations.
This crate provides a ThreadCounter type that can be used to keep track
of the number of active threads or operations, and to synchronize the
completion of these operations. It's particularly useful for scenarios where
you need to wait for a group of tasks to complete before proceeding.
Features
- Thread-safe counting of active operations.
- RAII-based automatic decrementing using
Tickets. - Ability to wait for all operations to complete, with optional timeout.
Usage
Here's a basic example of how to use the ThreadCounter:
use ;
use ThreadCounter;
let counter = default;
// Spawn some threads
for _ in 0..5
// Wait for all threads to complete, timing out after 200ms.
counter.wait;
println!;
Current version: 0.1.0
Some additional info here
License
thread-counter is dual-licensed under the MIT license and the Apache License (Version 2.0).