ANeuralNetworksExecution_setLoopTimeout

Function ANeuralNetworksExecution_setLoopTimeout 

Source
pub unsafe extern "C" fn ANeuralNetworksExecution_setLoopTimeout(
    execution: *mut ANeuralNetworksExecution,
    duration: u64,
) -> c_int
Expand description

Set the maximum duration of WHILE loops in the specified execution.

This is a fuzzy per-loop timeout intended to prevent infinite loops.

If a WHILE loop condition model does not output false within the specified duration, the execution will be aborted.

See {@link ANeuralNetworks_getDefaultLoopTimeout} and {@link ANeuralNetworks_getMaximumLoopTimeout} for the default and maximum timeout values.

See {@link ANeuralNetworksExecution} for information on multithreaded usage.

@param execution The execution to be modified. @param duration The maximum amount of time in nanoseconds that can be spent executing a WHILE loop. If the specified duration value exceeds the value produced by {@link ANeuralNetworks_getMaximumLoopTimeout}, it will be overridden by that value.

@return ANEURALNETWORKS_NO_ERROR if successful. ANEURALNETWORKS_BAD_STATE if execution has started. ANEURALNETWORKS_UNEXPECTED_NULL if execution is NULL.

Available since API level 30.