sleep
|
The sleep function causes the current context thread to halt processing
for the specified number of miliseconds. This allows the thread resources to be
freed for use in other threads or other processes.
Usage The sleep function is used in a multi-tasking environment to temporarily
halt the processing of the current context thread. After the specified time, the
current context thread resumes execution at the instruction following the sleep function.
For instance, the following code uses the sleep function to wait for the child context to start and to finish.
Since the spawned context will execute asynchronously, the current context must first sleep while waiting for the spawned context to become busy.
Then the current context must sleep while waiting for the spawned context to complete.
In the meantime, the current context queries for progress reports and then for the final result.
(setq context (contextOpen "ArcTwinContext.sl" false))
(contextSubmit context {(setq x 0)(loop for n from 0 until 10000 do (writeln (++ x))) (append "Finished - " x)})
(while (not (contextBusy context)) do (sleep 100.0))(writeln "Process is starting")
(while (contextBusy context) do (writeln "Progress is: " (contextGetDisplay context)) (sleep 100.0))
(writeln "Result is: " (setq result (contextGetResult context)))
(contextClose context)
(if (<> result "10000") then (error "expected 10000 as the result value"))
(sleep number) true
Expression:
Arguments
Name
Type
Description Argument: number Number Integer
The number of miliseconds to halt processing on the current context thread.
Returns:
Here are a number of links to Lambda coding examples which contain this instruction in various use cases.
Here are the links to the data types of the function arguments.
Number |
Here are also a number of links to functions having arguments with any of these data types.
Analytic Information Server (AIS)AIS Component Systems
|