Link to home
Start Free TrialLog in
Avatar of dabestprogrammerindauniverse
dabestprogrammerindauniverse

asked on

Sleep method

what is the effect of the Sleep method in delphi? is it safe to use?  thanks in advance!
Avatar of robert_marquardt
robert_marquardt

Your program will not get any CPU for the duration.
It is safe, only your messages arrive but do not get  handled (no CPU for you). In case of a timer this may get problematic for your program logic.
there are also other waiting methods
SleepEx, WaitForSingleObject, WaitForMultipleObcects
read about them in help :)
Yes, the difference is that these functions wait also (or only) for external events you requested.
ASKER CERTIFIED SOLUTION
Avatar of AvonWyss
AvonWyss
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in a delphi application it only makes sense to use Sleep in a new thread. if u use sleep in e.g. form1 procedure then the app will appear to delay during that Sleep. user will notice app lock if moves window accros dewktop. the window freeses during Sleep