Skip to content

set_operator_timeoutSetOperatorTimeoutSetOperatorTimeoutset_operator_timeoutset_operator_timeoutπŸ”—

Short descriptionπŸ”—

set_operator_timeoutSetOperatorTimeoutSetOperatorTimeoutset_operator_timeoutset_operator_timeout β€” Set a timeout for an operator.

SignatureπŸ”—

set_operator_timeout( string OperatorName, number Timeout, string Mode )void SetOperatorTimeout( const HTuple& OperatorName, const HTuple& Timeout, const HTuple& Mode )static void HOperatorSet.SetOperatorTimeout( HTuple operatorName, HTuple timeout, HTuple mode )def set_operator_timeout( operator_name: MaybeSequence[str], timeout: MaybeSequence[Union[int, float, str]], mode: str ) -> None

Herror set_operator_timeout( const char* OperatorName, double Timeout, const char* Mode )

Herror T_set_operator_timeout( const Htuple OperatorName, const Htuple Timeout, const Htuple Mode )

DescriptionπŸ”—

set_operator_timeoutSetOperatorTimeout sets a timeout for the operator OperatorNameoperatorNameoperator_name. Timeouttimeouttimeout is given in seconds. Setting Timeouttimeouttimeout to 00 or 'off'"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 OperatorNameoperatorNameoperator_name. In this case, one can either pass a single timeout in Timeouttimeouttimeout, which is then set for all operators, or one timeout per operator.

Two timeout modes are supported and selected with Modemodemode:

  • β€˜cancel’ 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’ 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.

AttentionπŸ”—

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.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: local (may only be called from the same thread in which the window, model, or tool instance was created).

  • Processed without parallelization.

ParametersπŸ”—

OperatorNameoperatorNameoperator_name (input_control) string(-array) β†’ (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Operator for which the timeout shall be set.

Timeouttimeouttimeout (input_control) number(-array) β†’ (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, float, str]]Htuple (double / Hlong / char*)

Timeout in seconds.

Default: 11
Suggested values: 1, 0.1, 0.5, 'off', 01, 0.1, 0.5, "off", 0

Modemodemode (input_control) string β†’ (string)HTuple (HString)HTuple (string)strHtuple (char*)

Timeout mode to be set.

Default: 'cancel'"cancel"
Suggested values: 'cancel', 'break'"cancel", "break"

ResultπŸ”—

The operator set_operator_timeoutSetOperatorTimeout returns the value 2 (H_MSG_TRUE) if the parameters are correct. Otherwise an exception will be raised.

Combinations with other operatorsπŸ”—

Combinations

Alternatives

interrupt_operatorInterruptOperator

See also

interrupt_operatorInterruptOperator, get_current_hthread_idGetCurrentHthreadId

ModuleπŸ”—

Foundation