Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-10

Sleep

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro

Is there a replacement for the sleep() function?

I just wanted to have a loop sleep for about 30 milliseconds at the end of each loop, but it appears that FPC doesn't include sleep().

Thanks, Tony

Reply by email

Peter Vreman
to Tony Maro
Is there a replacement for the sleep() function? I just wanted to have a loop sleep for about 30 milliseconds at the end of each loop, but it appears that FPC doesn't include sleep().

Nanosleep()

or

tv.u_sec=0;
tv.u_msec=0;
Select(0,NULL,NULL,NULL,tv);

(maybe the field names are not correct)

Reply by email

Marco van de Voort
to Tony Maro: Is there a replacement for the sleep() function? I just wanted to have a loop sleep for…
Is there a replacement for the sleep() function? I just wanted to have a loop sleep for about 30 milliseconds at the end of each loop, but it appears that FPC doesn't include sleep().

sleep is a win32 function, so it is in unit Windows.

Linux and FreeBSD have nanosleep (so do your msec *1000) in unit linux.

Some of these things are current being addressed in the 1.1 RTL cleanups, but this isn't finished yet.

Reply by email