MI_Operation_Cancel function (mi.h)

Cancels a running operation.

Syntax

MI_INLINE MI_Result MI_Operation_Cancel(
  [in, out] MI_Operation          *operation,
            MI_CancellationReason reason
);

Parameters

[in, out] operation

A pointer to an operation handle that was returned from a call to one of the MI_Session operation functions. For asynchronous callbacks, this value can be the operation handle that is passed into the callback.

reason

MI_CancellationReason enumeration value.

Return value

A value of the MI_Result enumeration that specifies the function return code. This can be one of the following codes.

Remarks

Cancellation is asynchronous. Cancelled operations still need to be closed. Cancellation will cause the operation to finish as soon as possible. For an asynchronous operation, this will cause final callback to happen with the final result. For a synchronous operation, the final result should be available soon.

A closing operation, such as MI_Operations_Cancel, should be called in same security context as the starting operation.

After cancellation, there may be more than just one result, because cancellation happens as soon as possible, so a few extra results may still get delivered. Not all operation cancellations get through to the provider for notification, though. (For example, enum can, but invoke cannot.) The client does disconnect from the server as soon as possible, though, so it will not wait for the entire operation to complete before giving a final result. Because not all operation cancellation can get to the server, it means that if the operation is taking quota (in terms of running operations, memory usage, and so on), then new operations may possibly fail with quota violations until the provider finally realizes the operation is canceled, and it shuts itself down.

Requirements

Requirement Value
Minimum supported client Windows 8
Minimum supported server Windows Server 2012
Target Platform Windows
Header mi.h
Redistributable Windows Management Framework 3.0 on Windows Server 2008 R2 with SP1, Windows 7 with SP1, and Windows Server 2008 with SP2