Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::Subscription Class Reference

UI-owned move-only cancellation token. Release before Scheduler. Disconnect is immediate logically; an executing callback owns its captures until return. Destruction/move assignment on a foreign thread terminates (affinity contract violation). More...

#include <scheduler.hpp>

Public Member Functions

 Subscription ()=default
 Empty disconnected token.
 ~Subscription ()
 Disconnect on UI; never joins a worker.
 Subscription (Subscription &&other) noexcept
 Transfer ownership on UI.
Subscription & operator= (Subscription &&other) noexcept
 Disconnect old token, then transfer.
 Subscription (const Subscription &)=delete
Subscription & operator= (const Subscription &)=delete
std::expected< void, SchedulerError > disconnect ()
 UI-only, idempotent; WRONG_THREAD leaves unchanged.

Friends

class Scheduler

Detailed Description

UI-owned move-only cancellation token. Release before Scheduler. Disconnect is immediate logically; an executing callback owns its captures until return. Destruction/move assignment on a foreign thread terminates (affinity contract violation).

Constructor & Destructor Documentation

◆ Subscription()

portals::Subscription::Subscription ( Subscription && other)
noexcept

Transfer ownership on UI.

Parameters
otherUI-owned token to empty and transfer into this token.

Member Function Documentation

◆ disconnect()

std::expected< void, SchedulerError > portals::Subscription::disconnect ( )

UI-only, idempotent; WRONG_THREAD leaves unchanged.

Returns
Success for an already empty/disconnected token; WRONG_THREAD leaves a live token unchanged.

◆ operator=()

Subscription & portals::Subscription::operator= ( Subscription && other)
noexcept

Disconnect old token, then transfer.

Parameters
otherUI-owned token to empty and transfer; self-assignment is a no-op.
Returns
This token after replacing its previous ownership.

The documentation for this class was generated from the following file: