Support sleep(0)
This commit is contained in:
parent
37a8bebd1b
commit
2342aefe9e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user