Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

Sleep Function

Overview

The Sleep function releases the script’s process thread and waits a specified amount of time before requeuing the script.

Syntax/Parameters

Syntax

int = Sleep ( int wait );

Parameters

wait

An int containing the minimum amount of time for the script to sleep in milliseconds. Setting the value to zero effectively yields the process.

Return Value

Returns an int as ERROR_NONE.

Remarks

This function causes a thread to relinquish the remainder of its time slice and become unrunnable for an interval based on the value of wait. The system clock “ticks” at a constant rate. If wait is less than the resolution of the system clock, the script may sleep for less than the specified length of time. If wait is greater than one tick but less than two, the script may sleep from anywhere between one and two ticks, and so on. If wait is zero milliseconds, the script will relinquish the remainder of its time slice but remain ready.

After the sleep interval has passed, the script is ready to run. Note that a ready thread is not guaranteed to run immediately. Consequently, the script may not run until some time after the sleep interval elapses. For more information, see Scheduling Priorities.

Note that while this function is superior to “looping” while waiting for an event, using the Sleep function within a loop will lockup the application if running in the primary thread. Programmers are cautioned about setting large time amounts with the wait parameter because the Sleep function cannot be interrupted and terminating the application may be required to stop it. 

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic