← All compilation units

Flyology.Wake_Sources

Description

Provides a readable one-shot descriptor for protected cancellation state.

Example:

Flyology.Wake_Sources.Signal (Wake);

Consume

procedure Consume (Item : in out Source)

Consume one pending signal while retaining the descriptor generation.

Parameters
Item

Serialized source with a pending signal

Raised exceptions
Program_Error

No signal is pending or reading fails

Descriptor

function Descriptor (Item : Source) return Interfaces.C.int

Borrow the current readable descriptor without transferring ownership.

Parameters
Item

Source to inspect

Return value

Read descriptor, or -1 before Ensure or after Release

Ensure

procedure Ensure (Item : in out Source)

Lazily allocate a nonblocking close-on-exec descriptor pair. Repeated calls before Release are harmless.

Parameters
Item

Serialized source to initialize

Raised exceptions
Program_Error

Descriptor creation or configuration fails

Release

procedure Release (Item : in out Source)

Close both owned descriptors. Repeated calls are harmless. A later Ensure creates a new descriptor generation.

Parameters
Item

Serialized source whose descriptors are released

Signal

procedure Signal (Item : in out Source)

Make Item's read end ready. Repeated signals remain readable until Consume or Release; this operation does not consume or close the source.

Parameters
Item

Serialized source to signal

Raised exceptions
Program_Error

Descriptor creation or signaling fails

Source

type Source is new Ada.Finalization.Limited_Controlled with private;

Controlled owner of a lazily created descriptor pair. Operations are intentionally unsynchronized: place Source inside a protected object or otherwise serialize every call. Finalize releases both descriptors.