Skip to content

Instantly share code, notes, and snippets.

@pandulaDW
Last active July 16, 2022 09:12
Show Gist options
  • Save pandulaDW/ccf55c1ef5ae3d8f3ccb6a4e4e5e34aa to your computer and use it in GitHub Desktop.
Save pandulaDW/ccf55c1ef5ae3d8f3ccb6a4e4e5e34aa to your computer and use it in GitHub Desktop.
wait function for wg
fn wait(&self) {
let mut started = self.0.mu.lock().unwrap();
while !*started {
started = self.0.condvar.wait(started).unwrap();
if self.0.counter.load(Ordering::Relaxed) == 0 {
*started = true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment