about summary refs log tree commit diff stats
path: root/kernel.soso/sleep.c
blob: bc7696985c04ae01c1cd732e0d4611f92e5c12f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#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();
}