Solved

Sleep method

Posted on 2002-06-24
5
400 Views
Last Modified: 2010-04-04
what is the effect of the Sleep method in delphi? is it safe to use?  thanks in advance!
0
Comment
5 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7103277
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.
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7105209
there are also other waiting methods
SleepEx, WaitForSingleObject, WaitForMultipleObcects
read about them in help :)
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7106467
Yes, the difference is that these functions wait also (or only) for external events you requested.
0
 
LVL 14

Accepted Solution

by:
AvonWyss earned 50 total points
ID: 7107118
Sleep only suspends the THREAD which it is called from, not the whole application. Sleep is not a method (it is not bound to any object) but rather a procedure. Its use is safe virtually everywhere.
0
 
LVL 3

Expert Comment

by:SteveWaite
ID: 7120832
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
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question