From 9e547f123af86f2bff83b3dbb83d7ee7ebf3ccc7 Mon Sep 17 00:00:00 2001 From: dimgigov Date: Wed, 10 Jun 2026 19:44:55 +0300 Subject: [PATCH] fix(scheduler): make Task_Sleep yield instead of block (MVP) --- rt/runtime.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rt/runtime.c b/rt/runtime.c index 82b4a7a..a992841 100644 --- a/rt/runtime.c +++ b/rt/runtime.c @@ -1010,8 +1010,11 @@ void bux_task_join(void* handle) { void bux_task_sleep(int64_t ms) { if (ms <= 0) return; if (g_scheduler && g_scheduler->current) { - g_scheduler->current->wake_at = bux_now_ms() + ms; - g_scheduler->current->state = BUX_TASK_BLOCKED; + /* MVP: yield instead of real sleep. Real sleep requires a timer to + * requeue BLOCKED tasks, which is complex. For now, yield lets + * other tasks run. Main-thread sleep still uses nanosleep. */ + (void)ms; /* silence unused warning for MVP */ + g_scheduler->current->state = BUX_TASK_READY; swapcontext(&g_scheduler->current->ctx, &g_scheduler_context); } else { struct timespec ts;