Sleep function
Posted: Sat Mar 21, 2015 7:30 am
I am trying to implement my own sleep function: `void sleep(int ticks);` that will stop kernel execution for number of specified ticks.
I tried this:
But it never stops... Where am i wrong? Who can help me to fix it?
I tried this:
Code: Select all
void sleep(int ticks) {
int start = get_tick(); // get_tick return current tick of system
int ticks_left = ticks;
while (ticks_left >= 0) {
ticks_left -= (get_tick() - start);
}
}