Last active
July 16, 2022 09:12
-
-
Save pandulaDW/ccf55c1ef5ae3d8f3ccb6a4e4e5e34aa to your computer and use it in GitHub Desktop.
wait function for wg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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