linuxsampler 2.3.1
LinuxSampler::DoubleBuffer< T > Class Template Reference

Synchronization / protection of data shared between multiple threads by using a double buffer design. More...

#include <SynchronizedConfig.h>

Public Member Functions

 DoubleBuffer ()
 
Sync< Tfront ()
 Synchronized access of the shared data for EXACTLY one real-time thread.
 
Sync< Tback ()
 Synchronized access of the shared data for multiple non-real-time threads.
 
const TunsafeBack () const
 Get the backbuffer data unprotected, that is without locking or any means of synchronizations.
 

Detailed Description

template<class T>
class LinuxSampler::DoubleBuffer< T >

Synchronization / protection of data shared between multiple threads by using a double buffer design.

The FrontBuffer is meant to be accessed by exactly one real-time thread, whereas the BackBuffer is meant to be accessed by multiple non-real-time threads.

This class is built on top of SynchronizedConfig as convenient API to reduce the amount of code required to protect shared data.

Definition at line 359 of file SynchronizedConfig.h.

Constructor & Destructor Documentation

◆ DoubleBuffer()

template<class T >
LinuxSampler::DoubleBuffer< T >::DoubleBuffer ( )
inline

Definition at line 361 of file SynchronizedConfig.h.

Member Function Documentation

◆ back()

template<class T >
Sync< T > LinuxSampler::DoubleBuffer< T >::back ( )
inline

Synchronized access of the shared data for multiple non-real-time threads.

The returned shared data is wrapped into a Sync object, which ensures that the shared data is protected against concurrent access during the life time of the returned Sync object.

As soon as the returned Sync object is destroyed, the FrontBuffer will automatically be exchanged by the hereby modified BackBuffer.

Definition at line 386 of file SynchronizedConfig.h.

◆ front()

template<class T >
Sync< T > LinuxSampler::DoubleBuffer< T >::front ( )
inline

Synchronized access of the shared data for EXACTLY one real-time thread.

The returned shared data is wrapped into a Sync object, which ensures that the shared data is protected against concurrent access during the life time of the returned Sync object.

Definition at line 372 of file SynchronizedConfig.h.

◆ unsafeBack()

template<class T >
const T & LinuxSampler::DoubleBuffer< T >::unsafeBack ( ) const
inline

Get the backbuffer data unprotected, that is without locking or any means of synchronizations.

Due to its nature this must only be called for read access and you have to make sure by yourself, that the data/member you access is really safe for concurrent read access (i.e. SGI's implementation of std::vector::size() would be safe).

Only use this when you are absolutely sure what you are doing!

Definition at line 399 of file SynchronizedConfig.h.


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