← All compilation units

Flyology.Cancellation

Description

Reports terminal cancellation. File I/O raises this only after the kernel has relinquished the caller's buffer.

Await_Request

procedure Await_Request (Item : in out Request_Waiter)

Wait until the one-shot request state becomes terminal.

Parameters
Item

Entry-bearing cancellation state to wait on

Await_Request

procedure Await_Request (Item : in out Token)

Wait until Request records terminal cancellation. Task-only waiting does not allocate a descriptor.

Parameters
Item

Token on which to wait

Operation_Cancelled

Operation_Cancelled : exception;

Reports terminal cancellation. File I/O raises this only after the kernel has relinquished the caller's buffer.

Request

procedure Request (Item : in out Token)

Record cancellation and wake every operation waiting on this token. Program_Error is raised when an existing borrowed wake descriptor cannot be signalled. Cancellation remains recorded when signalling fails. The signal and any EINTR retry occur after the state lock exits.

Parameters
Item

Token on which to record cancellation

Request_Waiter

type Request_Waiter is synchronized interface;

Entry-bearing view for an abortable select. The Token must outlive the selected call. Use Stop.Wait_Event.Await_Request as the trigger.

Requested

function Requested (Item : Token) return Boolean

Inspect the one-shot state without allocating a wake descriptor.

Parameters
Item

Token to inspect

Return value

True once Request records cancellation, including when wake signaling subsequently fails

Token

type Token is tagged limited private;

Thread-safe one-shot source. Request is idempotent and cannot be reset. Finalization releases lazily created wake descriptors after all borrowing operations have left scope.

Wait_Event

function Wait_Event (Item : aliased in out Token) return not null access Request_Waiter'Class

Borrow the protected entry for an abortable select.

Parameters
Item

Token that must outlive the select

Return value

Entry-bearing view of Item's one-shot state

Wait_Source

procedure Wait_Source (Item : in out Token; FD : out Interfaces.C.int; Already_Requested : out Boolean)

Borrow the readable wake descriptor. Ownership remains with Token; callers must not close it, and Token must outlive the wait. No descriptor is allocated when cancellation was already requested. Descriptor creation occurs outside the protected state lock.

Parameters
Item

Token that owns the borrowed descriptor

FD

Borrowed descriptor, or -1 when already requested

Already_Requested

True when Request preceded this call

Raised exceptions
Program_Error

Wake descriptor creation fails