IForeThreadClass.Sleep

Syntax

Sleep(Timeout: Integer);

Parameters

Timeout. Time in milliseconds.

Description

The Sleep method pauses the current application thread for the specified time.

Example

Add a link to the Fore system assembly.

Sub UserProc;
Var
    ci: ICultureInfo;
    t1, t2: DateTime;
    t3: TimeSpan;
Begin
    ci := CultureInfo.Invariant;
    t1 := DateTime.Now;
    Debug.WriteLine("Start: " + ci.FormatTimeEx(t1, "HH:mm:ss"));
    // Pause code execution
    ForeThreadClass.Sleep(5000);
    // Resume code execution
    t2 := DateTime.Now;
    t3 := t2 - t1;
    Debug.WriteLine("Stop: " + ci.FormatTimeEx(t2, "HH:mm:ss"));
    Debug.WriteLine("Execution time: " + t3.TotalMilliseconds.ToString + " milliseconds.");
End Sub UserProc;

Code execution is paused during example execution. Start time, stop time, and code execution are displayed in the development environment console time.

See also:

IForeThreadClass