Skip to content

Instantly share code, notes, and snippets.

@pandulaDW
Last active July 16, 2022 08:42
Show Gist options
  • Save pandulaDW/064a1f1378e390a5ad0250b2c60d4622 to your computer and use it in GitHub Desktop.
Save pandulaDW/064a1f1378e390a5ad0250b2c60d4622 to your computer and use it in GitHub Desktop.
wg-impl
use std::sync::atomic::AtomicUsize;
use std::sync::{Condvar, Mutex};
struct Wg {
counter: AtomicUsize,
mu: Mutex<bool>,
condvar: Condvar,
}
impl Wg {
fn new() -> Self {
Wg {
counter: AtomicUsize::new(0),
mu: Mutex::new(false),
condvar: Condvar::new(),
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment