Class Lease

Class Documentation

class Lease

Declaration: final

Scoped keyboard-focus ownership.

Releasing an old owner cannot clear a newer focus request, including one using the same target ID. Move/release on any thread with exclusive access to this handle. Retains only routing state, not the widget/adapter. Release clears focus without restoring older requests.

Public Functions

Lease() = default

Create an empty lease with target/epoch0 and no ownership.

~Lease()

Release only this request; never clear a newer owner or restore an older request.

Lease(Lease &&other) noexcept

Transfer retained request state; source becomes empty.

Serialize access to both handle objects.

Lease &operator=(Lease &&other) noexcept

Reset this request then transfer other.

Old-owner release cannot affect a newer focus publication.

Lease(const Lease&) = delete
Lease &operator=(const Lease&) = delete
void reset() noexcept

Idempotently release this request if still current, then empty the handle.

May run on any thread with exclusive handle access; collected records remain routed to their old target/epoch.

bool owns_focus() const

Declaration: [[nodiscard]]

Observe whether this request is still current; another producer can replace ownership immediately after return.

inline TargetId target() const

Declaration: [[nodiscard]]

Return this retained request’s target,0 for empty.

A preempted lease keeps its original target until reset.

inline std::uint64_t epoch() const

Declaration: [[nodiscard]]

Return request epoch,0 for empty; preemption alone does not change it.