Cancel

Contents

Cancel#

template<typename T>
void YR::Cancel(const ObjectRef<T> &obj, bool isForce = true, bool isRecursive = false)#

Cancel the corresponding function call by specifying an ObjectRef.

auto obj = YR::Function(Handler).Invoke(1);
YR::Cancel(obj);

Template Parameters:

T – The type of the object to cancel.

Parameters:
  • obj – A collection of object references in the data system.

  • isForce – When set to true, if a function call is currently executing, the function instance process corresponding to the function call will be forcibly terminated. Note: Currently, forcibly terminating function instances with a concurrency configuration other than 1 is not supported. The default value is true.

  • isRecursive – Setting it to true will cancel nested function calls. The default value is false.

template<typename T>
void YR::Cancel(const std::vector<ObjectRef<T>> &objs, bool isForce = true, bool isRecursive = false)#

Cancel the corresponding function call by specifying a set of ObjectRef.

int num = 5;
std::vector<YR::ObjectRef<int>> vec;
for (int i = 0; i < num; ++i) {
    auto obj = YR::Function(Handler).Invoke(i);
    vec.emplace_back(std::move(obj));
}
YR::Cancel(vec);

Template Parameters:

T – The type of the object to cancel.

Parameters:
  • objs – A reference to the object in the data system.

  • isForce – When set to true, if a function call is currently executing, the function instance process corresponding to the function call will be forcibly terminated. Note: Currently, forcibly terminating function instances with a concurrency configuration other than 1 is not supported. The default value is true.

  • isRecursive – Setting it to true will cancel nested function calls. The default value is false.

Throws:

Exception

  1. Local mode does not support Cancel, and an exception “local mode does not support cancel” will be thrown.

  2. Objs should not be empty, and an exception “Cancel does not accept empty object list” will be thrown.