Table of Contents

Class AsyncIOOutcome

Namespace
Sdl3Sharp.IO
Assembly
Sdl3Sharp.dll

Represents the outcome of an asynchronous I/O operation

public sealed class AsyncIOOutcome : IDisposable
Inheritance
AsyncIOOutcome
Implements
Inherited Members

Properties

AsyncIO

Gets the AsyncIO that initiated the operation that resulted in this AsyncIOOutcome

public AsyncIO? AsyncIO { get; }

Property Value

AsyncIO

The AsyncIO that initiated the operation that resulted in this AsyncIOOutcome, or null if it cannot be determined

Remarks

Please note that the associated AsyncIO may have already been become invalid (for example, if it has been closed) by the time this property is accessed.

Buffer

Gets the buffer where data was read into or written from

public ReadOnlyNativeMemory Buffer { get; }

Property Value

ReadOnlyNativeMemory

The buffer where data was read into or written from

Remarks

Please not that the returned memory buffer is just referencing the originally provided buffer. That means that operations like pinning it wont actually pin the original buffer. If the original buffer was provided as NativeMemory/ReadOnlyNativeMemory or as Memory<T>/ReadOnlyMemory<T>, then you can be sure that the original buffer will stay pinned for the lifetime of this AsyncIOOutcome instance.

BytesRequested

Gets the number of bytes that were requested to be read or written

public ulong BytesRequested { get; }

Property Value

ulong

The number of bytes that were requested to be read or written

BytesTransferred

Gets the number of bytes that were actually read or written

public ulong BytesTransferred { get; }

Property Value

ulong

The number of bytes that were actually read or written

Remarks

The value of the property is also the value of the Length property of the Buffer.

Offset

Gets the offset within underlying data stream where the operation started

public ulong Offset { get; }

Property Value

ulong

The offset within underlying data stream where the operation started

Result

Gets the result of the asynchronous I/O operation

public AsyncIOResult Result { get; }

Property Value

AsyncIOResult

The result of the asynchronous I/O operation

Type

Gets the type of the asynchronous I/O operation

public AsyncIOTaskType Type { get; }

Property Value

AsyncIOTaskType

The type of the asynchronous I/O operation

UnsafeAsyncIO

Gets a raw pointer to the underlying unmanaged asynchronous I/O structure that initiated the operation that resulted in this AsyncIOOutcome

public void* UnsafeAsyncIO { get; }

Property Value

void*

A raw pointer to the underlying unmanaged asynchronous I/O structure that initiated the operation that resulted in this AsyncIOOutcome

Remarks

In most cases, you wont need to use this property. AsyncIO offers a safe and managed way to access the initiating AsyncIO.

UnsafeUserdata

Gets a raw user-defined data pointer that was associated with the asynchronous I/O operation

public void* UnsafeUserdata { get; }

Property Value

void*

A raw user-defined data pointer that was associated with the asynchronous I/O operation

Remarks

Use this property to access a raw user-defined data pointer if the asynchronous I/O operation was initiated via one of the unsafe operations on the initiating AsyncIO (for example, via the userdata parameter of TryUnsafeRead(void*, ulong, ulong, AsyncIOQueue, void*)), or if it was initiated externally. If the asynchronous I/O operation was initiated via one of the safe operations (for example, via TryRead(NativeMemory, ulong, AsyncIOQueue, object?)), you might want to use the Userdata property to get the managed user-defined data in a safe way instead.

Userdata

Gets the user-defined data that was associated with the asynchronous I/O operation

public object? Userdata { get; }

Property Value

object

The user-defined data that was associated with the asynchronous I/O operation

Remarks

The value of this property will only be non-null if user-defined data was provided to one of the safe operations on the initiating AsyncIO (for example, via the userdata parameter of TryRead(NativeMemory, ulong, AsyncIOQueue, object?)). If the asynchronous I/O operation was initiated via one of the unsafe operations (for example, via TryUnsafeRead(void*, ulong, ulong, AsyncIOQueue, void*)) or if it was initiated externally, use the UnsafeUserdata property to access a raw user-defined data pointer instead.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~AsyncIOOutcome()

protected ~AsyncIOOutcome()