C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::async::blocking_producer< T > Class Template Reference

Blocking interface for emitting items to an asynchronous consumer. More...

#include <blocking_producer.hpp>

Public Types

using impl_ptr = intrusive_ptr<impl>
 

Public Member Functions

 blocking_producer (const blocking_producer &)=delete
 
blocking_produceroperator= (const blocking_producer &)=delete
 
 blocking_producer (blocking_producer &&)=default
 
blocking_produceroperator= (blocking_producer &&)=default
 
 blocking_producer (impl_ptr ptr)
 
 blocking_producer (spsc_buffer_ptr< T > buf)
 
bool push (const T &item)
 Pushes an item to the consumer.
 
bool push (span< const T > items)
 Pushes multiple items to the consumer.
 
void close ()
 
void abort (error reason)
 
bool canceled () const
 Checks whether the consumer canceled its subscription.
 
 operator bool () const noexcept
 

Related Symbols

(Note that these are not member symbols.)

template<class T >
blocking_producer< T > make_blocking_producer (spsc_buffer_ptr< T > buf)
 
template<class T >
std::optional< blocking_producer< T > > make_blocking_producer (producer_resource< T > res)
 
template<class T >
std::pair< blocking_producer< T >, consumer_resource< T > > make_blocking_producer ()
 

Detailed Description

template<class T>
class caf::async::blocking_producer< T >

Blocking interface for emitting items to an asynchronous consumer.

Member Function Documentation

◆ push() [1/2]

template<class T >
bool caf::async::blocking_producer< T >::push ( const T & item)

Pushes an item to the consumer.

If there is no demand by the consumer to deliver the item, this functions blocks unconditionally.

Returns
true if the item was delivered to the consumer or false if the consumer no longer receives any additional item.

◆ push() [2/2]

template<class T >
bool caf::async::blocking_producer< T >::push ( span< const T > items)

Pushes multiple items to the consumer.

If there is no demand by the consumer to deliver all items, this functions blocks unconditionally until all items have been delivered.

Returns
true if all items were delivered to the consumer or false if the consumer no longer receives any additional item.

Friends And Related Symbol Documentation

◆ make_blocking_producer()

template<class T >
blocking_producer< T > make_blocking_producer ( spsc_buffer_ptr< T > buf)
related
Precondition
buf != nullptr

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