AsyncFileIoRequest class
An asynchronous file read or write.
- Use
import ThinkMeta.ConcurrentTasks.AsyncIo.AsyncFileIoRequest;- Namespace
ThinkMeta::ConcurrentTasks::AsyncIo- Inherits
AsyncIoRequest- Platforms
- Windows, Linux
Syntax
class AsyncFileIoRequest : public AsyncIoRequest<Platform::ErrorCode>Remarks
Holds the file offset to transfer at, and after completion the platform's error code (GetError, compare it through Platform::Error) and the transferred bytes (GetTransferredBytes). A read that starts at or beyond the end of the file completes with Platform::Error::EndOfFile on every platform. Not usable on its own: use WaitableAsyncFileIoRequest(_s), or an own request type built on it that reacts to the completion in RequestCompleted. The request must stay alive while its operation is pending (see AsyncIoRequestBase).
See also
WaitableAsyncFileIoRequest_s, AsyncFile
Constructors
AsyncFileIoRequestprotected
Methods
GetOffset
The 64-bit file offset of the operation.
Syntax
[[nodiscard]] std::uint64_t GetOffset() const noexcept;Return value
Type: std::uint64_t
The file offset in bytes; 0 after Reset.
Remarks
Stored in OVERLAPPED Offset/OffsetHigh on Windows, in IoRequest::offset elsewhere.
See also
SetOffset
Sets the file offset for the next operation.
Syntax
void SetOffset(std::uint64_t offset) noexcept;Parameters
offsetstd::uint64_t- File offset in bytes to read or write at; sector-aligned for a file opened unbuffered (
FILE_FLAG_NO_BUFFERING,O_DIRECT).
Remarks
Call after Reset (which zeroes it) and before issuing; the asynchronous operations use no file pointer, every operation needs one.
See also
RequestCompleted
Stores the error code and the transferred bytes; signals nothing.
Syntax
void RequestCompleted(
CompletionError error,
ByteCount bytesTransferred
) noexcept override;Parameters
errorCompletionError- The operation's error code;
0when it succeeded. bytesTransferredByteCount- Bytes the operation transferred.
Remarks
Outside Windows a read of 0 bytes that asked for more is stored as Platform::Error::EndOfFile: Linux reports the end of a file that way, Windows as ERROR_HANDLE_EOF.
Generated from ThinkMeta.ConcurrentTasks.API @ c7663c4 (2026-11-19).