diff --git a/sys/kern/syscall.c b/sys/kern/syscall.c index 0546ca8..a97b3bc 100644 --- a/sys/kern/syscall.c +++ b/sys/kern/syscall.c @@ -327,11 +327,14 @@ Syscall_ThreadSleep(uint64_t time) { Thread *cur = Thread_Current(); - cur->timerEvt = Timer_Create(time, ThreadWakeupHelper, cur); - if (cur->timerEvt == NULL) - return -ENOMEM; + // If the sleep time is zero just yield + if (time != 0) { + cur->timerEvt = Timer_Create(time, ThreadWakeupHelper, cur); + if (cur->timerEvt == NULL) + return -ENOMEM; - Thread_SetWaiting(cur); + Thread_SetWaiting(cur); + } Thread_Scheduler(); return 0;