Skip to content

Commit 1f32d20

Browse files
committed
fix missing non specialized windows sleep fn
1 parent f8850e1 commit 1f32d20

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

library/std/src/sys/pal/windows/thread.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ impl Thread {
116116
}
117117
}
118118

119+
pub fn sleep_until(deadline: Instant) {
120+
let now = Instant::now();
121+
122+
if let Some(delay) = deadline.checked_duration_since(now) {
123+
sleep(delay);
124+
}
125+
}
126+
119127
pub fn handle(&self) -> &Handle {
120128
&self.handle
121129
}

0 commit comments

Comments
 (0)