mu/kernel.soso/sleep.c

18 lines
318 B
C

#include "sleep.h"
#include "timer.h"
void sleepMilliseconds(Thread* thread, uint32 ms)
{
uint32 uptime = getUptimeMilliseconds();
//target uptime to wakeup
uint32 target = uptime + ms;
thread->state = TS_SLEEP;
thread->state_privateData = (void*)target;
enableInterrupts();
halt();
}