KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Sleeping

Low-level thread sleeping More...

Functions

void timer_spin_sleep (int ms)
 Spin-loop sleep function.
 
void timer_spin_delay_us (unsigned short us)
 Spin-loop delay function with microsecond granularity.
 
void timer_spin_delay_ns (unsigned short ns)
 Spin-loop delay function with nanosecond granularity.
 

Detailed Description

Low-level thread sleeping

This API provides the low-level functionality used to implement thread sleeping, used by the KOS, C, C++, and POSIX threading APIs.

Warning
This API and its underlying functionality are using TMU1, so any direct manipulation of it will interfere with the API's proper functioning.

Function Documentation

◆ timer_spin_delay_ns()

void timer_spin_delay_ns ( unsigned short ns)

Spin-loop delay function with nanosecond granularity.

This function is meant as a very accurate delay function, even if threading and interrupts are disabled. It is a delay and not a sleep, which means that the CPU will be busy-looping during that time frame.

Parameters
nsThe number of nanoseconds to wait for.
See also
timer_spin_delay_us, thd_sleep

◆ timer_spin_delay_us()

void timer_spin_delay_us ( unsigned short us)

Spin-loop delay function with microsecond granularity.

This function is meant as a very accurate delay function, even if threading and interrupts are disabled. It is a delay and not a sleep, which means that the CPU will be busy-looping during that time frame. For any time frame bigger than a few hundred microseconds, it is recommended to sleep instead.

Parameters
usThe number of microseconds to wait for.
See also
timer_spin_delay_ns, thd_sleep

◆ timer_spin_sleep()

void timer_spin_sleep ( int ms)

Spin-loop sleep function.

This function is meant as a very accurate delay function, even if threading and interrupts are disabled. It uses TMU1 to sleep.

Parameters
msThe number of milliseconds to sleep.