Luna/kernel/src/sys/usleep.cpp

16 lines
315 B
C++
Raw Normal View History

#include "sys/Syscall.h"
#include "thread/Scheduler.h"
#include <sys/types.h>
Result<u64> sys_usleep(Registers*, SyscallArgs args)
{
useconds_t us = (useconds_t)args[0];
// FIXME: Allow usleep() to use a more precise resolution.
if (us < 1000) return 0;
kernel_sleep(us / 1000);
return 0;
}