Table of Contents

Struct ComAsyncResult

Namespace
Hi3Helper.Plugin.Core
Assembly
Hi3Helper.Plugin.Core.dll

Represents the result of a COM asynchronous operation.

public struct ComAsyncResult : IDisposable
Implements
Inherited Members
Extension Methods

Constructors

ComAsyncResult()

Represents the result of a COM asynchronous operation.

public ComAsyncResult()

Fields

Handle

The handle to the SafeWaitHandle.

public nint Handle

Field Value

nint

Properties

ExceptionMemory

The span handle in which stores the information of the exceptions on ComAsyncException struct.

public PluginDisposableMemory<ComAsyncException> ExceptionMemory { readonly get; set; }

Property Value

PluginDisposableMemory<ComAsyncException>

IsCancelled

Whether the task is cancelled or not.

public bool IsCancelled { readonly get; set; }

Property Value

bool

IsFaulty

Whether the task is faulted or not.

public bool IsFaulty { readonly get; set; }

Property Value

bool

IsSuccessful

Whether the task is successfully executed or not.

public bool IsSuccessful { readonly get; set; }

Property Value

bool

Methods

Alloc(Lock, Task)

Create/Alloc an instance of ComAsyncResult struct.

public static nint Alloc(Lock threadLock, Task task)

Parameters

threadLock Lock

Thread lock to be used to create the ComAsyncResult struct.

task Task

The Task instance in which the result being passed to ComAsyncResult

Returns

nint

A handle of the ComAsyncResult struct.

Alloc<T>(Lock, Task<T>)

Create/Alloc an instance of ComAsyncResult struct.

public static nint Alloc<T>(Lock threadLock, Task<T> task) where T : unmanaged

Parameters

threadLock Lock

Thread lock to be used to create the ComAsyncResult struct.

task Task<T>

The Task instance in which the result being passed to ComAsyncResult

Returns

nint

A handle of the ComAsyncResult struct.

Type Parameters

T

Dispose()

Dispose this instance of the current ComAsyncResult struct.

public void Dispose()

FreeResult(nint)

Dispose/Free the ComAsyncResult struct from its pointer.

public static void FreeResult(nint resultP)

Parameters

resultP nint

A pointer of the ComAsyncResult struct.

GetWaitHandle(nint)

Gets the SafeWaitHandle handle from ComAsyncResult's handle.

public static nint GetWaitHandle(nint handle)

Parameters

handle nint

A handle of the ComAsyncResult struct.

Returns

nint

A SafeWaitHandle handle.

SetResult(Lock, Task)

Set the result of the task. This method is also used to write the information about the Task execution status/result to then being passed to managed code which loads the plugin.

public void SetResult(Lock threadLock, Task task)

Parameters

threadLock Lock

Thread lock to be used to set the result.

task Task

The Task in which the status/result is being written from.

SetResult<T>(Lock, Task<T>)

Set the result of the task. This method is also used to write the information about the Task execution status/result to then being passed to managed code which loads the plugin.

public void SetResult<T>(Lock threadLock, Task<T> task) where T : unmanaged

Parameters

threadLock Lock

Thread lock to be used to set the result.

task Task<T>

The Task in which the status/result is being written from.

Type Parameters

T