about summary refs log blame commit diff stats
path: root/kernel.soso/sleep.c
blob: bc7696985c04ae01c1cd732e0d4611f92e5c12f1 (plain) (tree)
1
2
3
4


                  
                                                   











                                              
#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();
}