From 8f30525cab4c0e7ed68e61f5f40da7db18e6ff49 Mon Sep 17 00:00:00 2001 From: Marvin Friedrich Date: Wed, 28 Oct 2026 21:49:28 +0100 Subject: [PATCH] sched: Add sched_sleep_until --- include/zinnia/sched.h | 2 ++ sched/core.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/include/zinnia/sched.h b/include/zinnia/sched.h index f4bf633..5bd43a7 100644 --- a/include/zinnia/sched.h +++ b/include/zinnia/sched.h @@ -132,6 +132,8 @@ void sched_wake_locked(struct task* task); void sched_notify(struct task* task); +void sched_sleep_until(uint64_t deadline_ns); + [[noreturn]] void sched_exit(); diff --git a/sched/core.c b/sched/core.c index 2f13a10..41ad4c6 100644 --- a/sched/core.c +++ b/sched/core.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -157,3 +158,8 @@ void task_lock(struct task* task) { void task_unlock(struct task* task) { spin_unlock(atomic_load(&task->lockp, ATOMIC_RELAXED)); } + +void sched_sleep_until(uint64_t deadline_ns) { + const uint8_t key = 0; + park_timeout(&key, nullptr, nullptr, nullptr, 0, &deadline_ns); +}