MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ pop_pending()

template<typename T >
std::optional< T > MayaFlux::Vruta::BroadcastSource< T >::pop_pending ( )
inlineprivate

Consume and return the pending value if one is available.

Called only from the coroutine's execution context.

Returns
The pending value, or std::nullopt.

Definition at line 113 of file BroadcastSource.hpp.

114 {
115 if (!m_pending_flag.load(std::memory_order_acquire))
116 return std::nullopt;
117 T val = m_pending_value;
118 m_pending_flag.store(false, std::memory_order_release);
119 return val;
120 }
T m_pending_value
Pending value written by signal() when no waiter is registered.

References MayaFlux::Vruta::BroadcastSource< T >::m_pending_flag, and MayaFlux::Vruta::BroadcastSource< T >::m_pending_value.