Solved

Sleep method

Posted on 2002-06-24
5
412 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 322
Printing problem 2 101
Intraweb download file link ? 1 153
Tvertscrollbox like a whatsapp layout 5 34
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

789 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