set_operator_timeout
— Set a timeout for an operator.
set_operator_timeout( : : OperatorName, Timeout, Mode : )
set_operator_timeout
sets a timeout for the
operator OperatorName
.
Timeout
is given in seconds.
Setting Timeout
to 0 or 'off' clears the timeout.
The timeout is set for the current thread only and is not inherited by
child threads.
Multiple operator names can be passed to OperatorName
.
In this case, one can either pass a single timeout in Timeout
,
which is then set for all operators, or one timeout per operator.
Two timeout modes are supported and selected with Mode
:
Cancels the execution of the operator after the timeout expires, raises the exception H_ERR_TIMEOUT (9400). All results computed by the operator are discarded.
Break the execution of the operator after the timeout expires. The operator returns normally. If possible, results computed by the operator up to the point of the timeout are returned.
Note that not all operators support timeouts. If a given operator supports timeouts and which modes are supported is described in the execution information section of the reference documentation of the corresponding operator.
Also note that there is no hard guarantee about the granularity of the timeout. The granularity can depend on the operator, its input data and the speed of the device. It is typically finer than 10 ms.
OperatorName
(input_control) string(-array) →
(string)
Operator for which the timeout shall be set.
Timeout
(input_control) number(-array) →
(real / integer / string)
Timeout in seconds.
Default: 1
Suggested values: 1, 0.1, 0.5, 'off' , 0
Mode
(input_control) string →
(string)
Timeout mode to be set.
Default: 'cancel'
Suggested values: 'cancel' , 'break'
The operator set_operator_timeout
returns the
value 2 (
H_MSG_TRUE)
if the parameters are correct. Otherwise
an exception will be raised.
interrupt_operator
,
get_current_hthread_id
Foundation