Solved

Sleep method

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now