ATEasy's Sleep(), Delay() and WaitForEvent() Functions Usage

Knowledge Base Article # Q200041

Read Prior Article Read Next Article
Summary Sleep() suspends the thread from which it was called (meaning it will also suspend UI such as form events, painting, etc.). Article discuss a workaround for the Sleep().
  
Login to rate article
Solution:

Sleep suspends the thread from which it was called (meaning it will also suspend UI such as form events, painting, etc.). If you wish to create an interval of time, you may call Delay() instead. However, Delay() consumes CPU time (see knowledge base article Q200030).

If that is a problem, you can use the following code:

Procedure DelayEx(lDelay)
{
lStart=Tick()

loop
   lTime=Tick()
   if lTime-lStart>lDelay than exitloop
   WaitForEvent(lStart+lDelay-Time)
   ! optional - call DoEvent() if you are calling this from a form event
endloop
}
Article Date 12/6/2002
Keywords ATEasy, Sleep(), Delay(), WaitForEvent()


Login to rate article

Read Prior Article Read Next Article
>