Template Function nvcv::ProtectCall

Function Documentation

template<class F>
NVCVStatus nvcv::ProtectCall(F &&fn)

Safely executes a function, capturing and setting any exceptions that arise.

This function acts as a wrapper to safely execute a given function or lambda (fn). If the function throws any exception, the exception is captured, and the error status is set for the current thread using the SetThreadError function.

Parameters:

fn – The function or lambda to be executed.

Template Parameters:

F – The type of the function or lambda.

Returns:

NVCV_SUCCESS if fn executed without exceptions, otherwise the error code from the caught exception.