[syslinux] proper way to sleep

H. Peter Anvin hpa at zytor.com
Tue Aug 21 10:27:47 PDT 2007

Miguel wrote:
> This is not spam about sleep aids :)
> Q: Is there a 'standard' way to sleep for a specified number of BIOS ticks
> (or seconds) in a com32 program?
> I grepped through the com32 library source and didn't find anything for
> 'sleep' or 'tick'.
> If not, you may want to consider adding:
>   void syslinux_sleep(int seconds);
>   void syslinux_sleep_bios_ticks(int ticks);
> or something like that.

Not sleep, but there is a standard busy wait, 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)

void syslinux_sleep(int seconds)

More information about the Syslinux mailing list