Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::Publisher< T > Class Template Reference

Copyable, worker-safe endpoint. It owns the closed channel state, never UI captures. May outlive Scheduler: publish then returns closed. T must own its transitively immutable data; mutable aliases must not modify it. Its deleter may run on UI or any producer thread. More...

#include <scheduler.hpp>

Public Member Functions

 Publisher ()=default
 Empty closed endpoint.
std::expected< PublishResult, SchedulerError > publish (std::shared_ptr< const T > value) const
 Transfer a strong immutable owner; null is INVALID_ARGUMENT, full is WOULD_BLOCK. No allocation occurs here. Failure changes no queue; the caller retains any other owner.
void wake () const noexcept
 Wake a waiter without queueing work.
void requestStop () const noexcept
 Close all publications; UI reclaims callbacks.

Friends

class Scheduler

Detailed Description

template<class T>
class portals::Publisher< T >

Copyable, worker-safe endpoint. It owns the closed channel state, never UI captures. May outlive Scheduler: publish then returns closed. T must own its transitively immutable data; mutable aliases must not modify it. Its deleter may run on UI or any producer thread.

Template Parameters
TTransitively immutable payload type owned by shared_ptr<const T>; its deleter must support any releasing thread.

Member Function Documentation

◆ publish()

template<class T>
std::expected< PublishResult, SchedulerError > portals::Publisher< T >::publish ( std::shared_ptr< const T > value) const
inline

Transfer a strong immutable owner; null is INVALID_ARGUMENT, full is WOULD_BLOCK. No allocation occurs here. Failure changes no queue; the caller retains any other owner.

Parameters
valueNon-null immutable snapshot owner transferred into the bounded queue.
Returns
queued or replaced on acceptance; closed for an unavailable endpoint, INVALID_ARGUMENT for null, or WOULD_BLOCK when no queue position can be used.

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