Preliminary. ThinkMeta ConcurrentTasks and this documentation are preliminary; everything is subject to change.

API reference / Windows

Error struct

Names and predicates for Win32 error codes.

Use
import ThinkMeta.ConcurrentTasks.Windows.Error;
Namespace
ThinkMeta::ConcurrentTasks::Windows

Syntax

struct Error

Remarks

The codes are the values of GetLastError. The Windows wrappers return an ErrorCode: Success, or the Win32 error of the failed call.

See also

ErrorException

Names

NameDescription
ErrorCode A Win32 error code as returned by the Windows wrappers.

Error::Success on success.

Methods

GetLastError

Returns the calling thread's last Win32 error (::GetLastError).

Syntax

static Type GetLastError() noexcept;

Return value

Type: Type

The thread's last Win32 error code; Success if none was set.

See also

GetError

GetError

Turns a Win32 BOOL result into an ErrorCode.

Syntax

static Type GetError(BOOL b) noexcept;

Parameters

bBOOL
The Win32 call's result: nonzero for success, FALSE for failure.

Return value

Type: Type

Success for TRUE, else GetLastError.

Remarks

Call it right after the API call, before anything else can overwrite the last error.

Succeeded

Returns whether error is Success.

Syntax

static bool Succeeded(const Type& error) noexcept;

Parameters

errorconst Type&
A Win32 error code.

Return value

Type: bool

true if error is Success; otherwise false.

See also

Failed

Failed

Returns whether error is anything but Success.

Syntax

static bool Failed(const Type& error) noexcept;

Parameters

errorconst Type&
A Win32 error code.

Return value

Type: bool

true for every code other than Success; otherwise false.

Remarks

Pending counts as failed.

See also

Succeeded

IsPending

Returns whether error is Pending.

Syntax

static bool IsPending(const Type& error) noexcept;

Parameters

errorconst Type&
A Win32 error code.

Return value

Type: bool

true if error is ERROR_IO_PENDING; otherwise false.

TooManyAsynchronousRequests

Returns whether error means too many overlapped requests.

Syntax

static bool TooManyAsynchronousRequests(const Type& error) noexcept;

Parameters

errorconst Type&
A Win32 error code.

Return value

Type: bool

true for ERROR_INVALID_USER_BUFFER and ERROR_NOT_ENOUGH_MEMORY; otherwise false.

Remarks

These are the codes Windows uses when too many overlapped requests are outstanding (ERROR_INVALID_USER_BUFFER, ERROR_NOT_ENOUGH_MEMORY): retry later.

IsEndOfStream

Returns whether error is EndOfStream.

Syntax

static bool IsEndOfStream(const Type& error) noexcept;

Parameters

errorconst Type&
A Win32 error code.

Return value

Type: bool

true if error is ERROR_HANDLE_EOF; otherwise false.

Types

Type

A Win32 error code (DWORD).

Syntax

using Type = DWORD;

Fields

Success

ERROR_SUCCESS (0): the operation succeeded.

Syntax

static constexpr Type Success = ERROR_SUCCESS;

BadFormat

Syntax

static constexpr Type BadFormat = ERROR_BAD_FORMAT;

InvalidBlock

Syntax

static constexpr Type InvalidBlock = ERROR_INVALID_BLOCK;

EndOfFile

ERROR_HANDLE_EOF: a read started at or beyond the end of the file.

Syntax

static constexpr Type EndOfFile = ERROR_HANDLE_EOF;

EndOfStream

Same value as EndOfFile, for streams and sockets.

Syntax

static constexpr Type EndOfStream = EndOfFile;

See also

IsEndOfStream

Pending

ERROR_IO_PENDING: an overlapped operation completes later.

Syntax

static constexpr Type Pending = ERROR_IO_PENDING;

See also

IsPending

InvalidHandle

Syntax

static constexpr Type InvalidHandle = ERROR_INVALID_HANDLE;

InvalidUserBuffer

Syntax

static constexpr Type InvalidUserBuffer = ERROR_INVALID_USER_BUFFER;

NotEnoughMemory

Syntax

static constexpr Type NotEnoughMemory = ERROR_NOT_ENOUGH_MEMORY;

InvalidParameter

Syntax

static constexpr Type InvalidParameter = ERROR_INVALID_PARAMETER;

NotFound

Syntax

static constexpr Type NotFound = ERROR_NOT_FOUND;

OperationAborted

Syntax

static constexpr Type OperationAborted = ERROR_OPERATION_ABORTED;

TimedOut

ERROR_TIMEOUT: a wait or operation with a timeout ran out of time.

Syntax

static constexpr Type TimedOut = ERROR_TIMEOUT;

Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).