Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
thread::Channel< T > Class Template Reference

A Channel is a bounded FIFO queue that allows multiple readers and writers to communicate with each other. More...

#include <cpp/symbian/concurrency/common/thread/channel.h>

Public Member Functions

 Channel (size_t capacity)
 Constructs a Channel with the given capacity.
 
 Channel (const Channel &)=delete
 
Channel & operator= (const Channel &)=delete
 
 ~Channel ()
 
Reader< T > *absl_nonnull reader ()
 Returns a Reader that can be used to read items from the channel.
 
Writer< T > *absl_nonnull writer ()
 Returns a Writer that can be used to write items to the channel.
 
size_t length () const
 Returns the instantaneous length of the channel.
 
 Channel (std::size_t capacity)
 
 Channel (const Channel &)=delete
 
Channel & operator= (const Channel &)=delete
 
 ~Channel ()
 
Reader< T > * reader ()
 
Writer< T > * writer ()
 
std::size_t length () const
 

Friends

struct internal::ReadSelectable< T >
 
struct internal::WriteSelectable< T >
 
class Reader< T >
 
class Writer< T >
 

Detailed Description

template<typename T>
requires std::is_move_assignable_v<T>
class thread::Channel< T >

A Channel is a bounded FIFO queue that allows multiple readers and writers to communicate with each other.

The channel has a fixed capacity, and will block writers if the channel is full, and readers if the channel is empty. If the channel is closed, all waiting readers will be notified that no more items will be written to the channel.

Constructor & Destructor Documentation

◆ Channel() [1/4]

template<typename T >
thread::Channel< T >::Channel ( size_t  capacity)
inlineexplicit

Constructs a Channel with the given capacity.

Parameters
capacityThe maximum number of items that can be buffered in the channel. If the channel is full, writers will block until space is available.

◆ Channel() [2/4]

template<typename T >
thread::Channel< T >::Channel ( const Channel< T > &  )
delete

◆ ~Channel() [1/2]

template<typename T >
thread::Channel< T >::~Channel ( )
inline

◆ Channel() [3/4]

template<typename T >
thread::Channel< T >::Channel ( std::size_t  capacity)
inlineexplicit

◆ Channel() [4/4]

template<typename T >
thread::Channel< T >::Channel ( const Channel< T > &  )
delete

◆ ~Channel() [2/2]

template<typename T >
thread::Channel< T >::~Channel ( )
inline

Member Function Documentation

◆ length() [1/2]

template<typename T >
size_t thread::Channel< T >::length ( ) const
inline

Returns the instantaneous length of the channel.

This method should never be used to determine whether the channel is full or empty, as it may return a value that is not consistent with the state of the channel at the time of the call.

◆ length() [2/2]

template<typename T >
std::size_t thread::Channel< T >::length ( ) const
inline

◆ operator=() [1/2]

template<typename T >
Channel & thread::Channel< T >::operator= ( const Channel< T > &  )
delete

◆ operator=() [2/2]

template<typename T >
Channel & thread::Channel< T >::operator= ( const Channel< T > &  )
delete

◆ reader() [1/2]

template<typename T >
Reader< T > *absl_nonnull thread::Channel< T >::reader ( )
inline

Returns a Reader that can be used to read items from the channel.

Multiple consumers can read from the channel concurrently, and every item written to the channel will be read by exactly one reader.

Returns
A Reader that can be used to read items from the channel.

◆ reader() [2/2]

template<typename T >
Reader< T > * thread::Channel< T >::reader ( )
inline

◆ writer() [1/2]

template<typename T >
Writer< T > *absl_nonnull thread::Channel< T >::writer ( )
inline

Returns a Writer that can be used to write items to the channel.

Multiple producers can write to the channel concurrently, and every item written to the channel, if read at all, will be read by exactly one reader. If the channel is at capacity, writers will block until space is available in the channel.

Returns
A Writer that can be used to write items to the channel.

◆ writer() [2/2]

template<typename T >
Writer< T > * thread::Channel< T >::writer ( )
inline

Friends And Related Symbol Documentation

◆ internal::ReadSelectable< T >

template<typename T >
friend struct internal::ReadSelectable< T >
friend

◆ internal::WriteSelectable< T >

template<typename T >
friend struct internal::WriteSelectable< T >
friend

◆ Reader< T >

template<typename T >
friend class Reader< T >
friend

◆ Writer< T >

template<typename T >
friend class Writer< T >
friend

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