about summary refs log blame commit diff stats
path: root/tools/iso/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();
}
23 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371