Exchange Table
A concurrency utility for coordinating request/response style exchanges between coroutines.
The table maintains two sides of communication:
Send table: holds values that represent requests (VS).
Receive table: holds values that represent responses (VR).
A request is initiated by calling waitFor, which stores the request data and suspends until a corresponding response is provided by notify. After completion (either by success or timeout), both request and response entries are cleaned up automatically.
Key Properties
Identifiers are composed of two parts: ID0 (outer) and ID1 (inner).
Each
(id0, id1)
pair may have at most one active waiter at a time.Requests and responses are timestamped internally to support cleanup.
This abstraction is useful for modeling one-off message exchanges, such as RPC-style request/response patterns or matching commands with replies.
Parameters
type of the outer identifier
type of the inner identifier
type of values stored in the send table (requests)
type of values stored in the receive table (responses)