Interface IAsyncInitializable
- Namespace
- DotCompute.Abstractions.Interfaces
- Assembly
- DotCompute.Abstractions.dll
Interface for components that support asynchronous initialization.
public interface IAsyncInitializable
Remarks
Implement this interface when a component requires async setup work before it can be used, such as loading resources, establishing connections, or performing device initialization.
Properties
IsInitialized
Gets a value indicating whether the component has been initialized.
bool IsInitialized { get; }
Property Value
Methods
InitializeAsync(CancellationToken)
Initializes the component asynchronously.
Task InitializeAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA token to cancel the initialization.
Returns
- Task
A task representing the asynchronous initialization operation.
Exceptions
- InvalidOperationException
Thrown if the component is already initialized.
- OperationCanceledException
Thrown if initialization is canceled.