WaitTrigger

abstract class WaitTrigger<out T>(source)

Describes something that can end a wait: a message arriving at a mailbox, a signal, items becoming available in a blocking queue. A trigger is obtained from the thing waited on (for example signal.trigger()), and is passed to waitForFirst, which waits until the first of its triggers fires or its time limit runs out.

A trigger is a description only. Creating one registers nothing, and one trigger may be used in any number of waits, one after another or by several entities at once, because everything a particular wait needs is kept by that wait. Two triggers are equal only when they are the same object, which is what a when on the result of waitForFirst compares.

This file holds the wait engine itself. Each kind of trigger, with its registration, is kept beside its source: SignalTrigger.kt, ItemsTrigger.kt (blocking queues), SeizeTriggers.kt (resources and pools), AllocationTriggers.kt, and the message trigger in the agent package's AgentMessaging.kt.

Type Parameters

T

the type of the value the trigger produces when it ends a wait