Page tree
Skip to end of metadata
Go to start of metadata

setScriptExecTimeOut(duration)

Description

Function to specify the maximum allowed execution time of a function call in the script. If the execution of a function call exceeds the execution time-out, the script will end with an execution error. This prevents the infinite execution of scripts, e.g., in case of an infinite loop. The script execution time-out can be defined separately for the controller and the processor thread. Which execution time-out is set, depends on where setScriptExecTimeOut is called. The duration for the script execution time-out is specified in milliseconds. The default is 5000 ms for the controller thread and 1000 ms for the processor thread.

Available in: Controller, Processor.

Arguments

durationThe duration for the script execution time-out in milliseconds.number

Example

-- half the default script execution time-out of the controller and the processor thread

-- controller thread
setScriptExecTimeOut(getScriptExecTimeOut() / 2)
print("Execution time-out of "..getContext()..": "..getScriptExecTimeOut().." ms.")

 -- processor thread
function onInit()
    setScriptExecTimeOut(getScriptExecTimeOut() / 2)
    print("Execution time-out of "..getContext()..": "..getScriptExecTimeOut().." ms.")
end

1 Comment