std: implement sleep_until on Motor

This commit is contained in:
joboet 2026-01-23 13:21:23 +01:00
parent 9283d592de
commit bd4211595d
No known key found for this signature in database
GPG key ID: 704E0149B0194B3C
2 changed files with 6 additions and 1 deletions

View file

@ -135,6 +135,7 @@ cfg_select! {
target_os = "vxworks",
target_os = "wasi",
target_vendor = "apple",
target_os = "motor",
)))]
pub fn sleep_until(deadline: crate::time::Instant) {
use crate::time::Instant;

View file

@ -3,7 +3,7 @@ use crate::io;
use crate::num::NonZeroUsize;
use crate::sys::map_motor_error;
use crate::thread::ThreadInit;
use crate::time::Duration;
use crate::time::{Duration, Instant};
pub const DEFAULT_MIN_STACK_SIZE: usize = 1024 * 256;
@ -62,3 +62,7 @@ pub fn yield_now() {
pub fn sleep(dur: Duration) {
moto_rt::thread::sleep_until(moto_rt::time::Instant::now() + dur)
}
pub fn sleep_until(deadline: Instant) {
moto_rt::thread::sleep_until(deadline.into_inner())
}