Question about "Delay"

Just starting out? Need help? Post your questions and find answers here.
User avatar
Caronte3D
Addict
Addict
Posts: 1371
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Question about "Delay"

Post by Caronte3D »

I know how to use Delay(time) to pause the program so not to eat all the processor cycles, but...
What is the function of Delay(0)?
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Question about "Delay"

Post by Fred »

It does a yield, a explained here: https://learn.microsoft.com/en-us/windo ... hapi-sleep
A value of zero causes the thread to relinquish the remainder of its time slice to any other thread that is ready to run. If there are no other threads ready to run, the function returns immediately, and the thread continues execution.
User avatar
Caronte3D
Addict
Addict
Posts: 1371
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Question about "Delay"

Post by Caronte3D »

Thanks! :wink:
User avatar
Skipper
User
User
Posts: 59
Joined: Thu Dec 19, 2024 1:26 pm
Location: Europe

Re: Question about "Delay"

Post by Skipper »

Is this behaviour identical on all platforms?
<< Win-11 (x64: XEON + i5) / Mint linux (x64: i3) / MacOS Monterey (Intel x64) >>
Post Reply