cheatah
Class

memory::Request

A promise for a lease — what Owner::rread()/rwrite<…>() return.

Move-only; block for the lease with acquire().

Template parameters
LeaseT

the Lease type this request resolves to.

Functions

fn Request · 3 overloads
Request(std::future< LeaseT > &&fut) noexceptsource#
Request(Request &&) noexcept=defaultsource#
Request(const Request &)=deletesource#

Wrap the owner-supplied future.

Parameters
fut

the future the owner fulfills.

Complexity

O(1).

Allocation

none.

fn Request & operator=(Request &&) noexcept=default source#

Move-assign (a request is move-only).

Returns

*this.

Complexity

O(1).

Allocation

none.

fn LeaseT acquire(std::function< void()> on_interrupt={}) source#

Redeem the request: wait for the owner's grant, then return the lease.

(Today's owner grants synchronously inside rread()/rwrite<…>(), so the wrapped future is already fulfilled and this returns at once.) on_interrupt is the requester's interruption handler — wired to the granted lease so if the owner later needs the lease back the handler fires. Omit it to rely purely on the lease's valid()/expired() polling. One-shot.

Parameters
on_interrupt

optional handler to run when the owner asks the lease to yield.

Returns

the granted lease.

Complexity

O(1) once granted; blocks only until the owner fulfills the request (already done by the time a Request exists today).

Allocation

none, unless on_interrupt is supplied — then one callback holder (via Lease::on_interrupt).

Concurrency

one-shot: a second acquire() on the same request throws std::future_error. on_interrupt later fires on whichever thread polls the lease's valid() — never asynchronously.

Constants & variables

var std::future< LeaseT > fut_ source#

owner-fulfilled; never exposed to cheatah.