gdDocumentation0.8.0

API reference

GDAsyncContext

Context passing the first cancellation reason and deadline from parent to child.

Properties

reason : Err

A failure value with a category, message, details, causes, and partial result. Err.NOT_FOUND and related names are shared values. join() retains independent failures, and find() searches every cause.

Methods

cancel

cancel(msg: String = "canceled", kind: Err = null) -> void

Cancel a script context with a shared error category.

Parameters

NameTypeDefaultDescription
msgString"canceled"Message text associated with this operation.
kindErrnullError kind used for classification and matching.

Return value

void

No value is returned.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

with_cancel

with_cancel() -> GDAsyncContext

Create a child inheriting parent cancellation.

Parameters

No parameters.

Return value

GDAsyncContext

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

with_timeout

with_timeout(sec: float) -> GDAsyncContext

Create a child context with a deadline measured in seconds. Cancelling the parent also cancels the child; the parent itself is not changed.

Parameters

NameTypeDefaultDescription
secfloatRequiredDuration until cancellation, in seconds.

Return value

GDAsyncContext

A new child context.

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.

See also

is_done

is_done() -> bool

Return whether cancellation or the deadline has completed this context.

Parameters

No parameters.

Return value

bool

Errors

This call has no Err return slot. Its return type and documented sentinel values determine how to inspect the result.