[syslinux] proper way to sleep

Miguel mth at mth.com
Tue Aug 21 10:43:53 PDT 2007


> Not sleep, but there is a standard busy wait,

You are correct ... not really sleeping.

> so you could have
> something like:
>
> #include <syslinux/idle.h>
> #include <sys/times.h>
>
> void syslinux_sleep_ticks(int ticks)
> {
> 	clock_t start = times(NULL);
>
> 	while (times(NULL) - start < ticks)
> 		syslinux_idle();
> }
>
> void syslinux_sleep(int seconds)
> {
> 	syslinux_sleep_ticks(seconds*CLK_TCK);
> }

Excellent!


Miguel




More information about the Syslinux mailing list