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

BackBuffer object to be accessed by multiple non-real-time threads. More...

#include <SynchronizedConfig.h>

Inheritance diagram for LinuxSampler::BackBuffer< T >:
LinuxSampler::SynchronizedConfig< T > LinuxSampler::Synchronizer< T >

Public Member Functions

virtual void beginSync () OVERRIDE
 Signal intention to enter a synchronized code block.
 
virtual TsyncedData () OVERRIDE
 Retrieve reference to critical, shared data.
 
virtual void endSync () OVERRIDE
 Signal that the synchronized code block has been left.
 
const TunsafeData () const
 
TGetConfigForUpdate ()
 Gets the configuration object for use by the non real time thread.
 
const TGetUnsafeUpdateConfig () const
 Get the data on update side for read-only access.
 
TSwitchConfig ()
 Atomically switch the newly updated configuration object with the one used by the real time thread, then wait for the real time thread to finish working with the old object before returning the old object.
 

Detailed Description

template<class T>
class LinuxSampler::BackBuffer< T >

BackBuffer object to be accessed by multiple non-real-time threads.

Since a back buffer is designed for being accessed by non-real-time threads, its methods involved may block the calling thread for a long amount of time.

Definition at line 303 of file SynchronizedConfig.h.

Member Function Documentation

◆ beginSync()

template<class T >
virtual void LinuxSampler::BackBuffer< T >::beginSync ( )
inlinevirtual

Signal intention to enter a synchronized code block.

Depending on the actual implementation, this call may block the calling thread until it is safe to actually use the protected data. After this call returns, it is safe for the calling thread to access and modify the shared data. As soon as the thread is done with accessing the shared data, it MUST call endSync().

Returns
the shared protected data

Implements LinuxSampler::Synchronizer< T >.

Definition at line 305 of file SynchronizedConfig.h.

◆ endSync()

template<class T >
virtual void LinuxSampler::BackBuffer< T >::endSync ( )
inlinevirtual

Signal that the synchronized code block has been left.

Depending on the actual implementation, this call may block the calling thread for a certain amount of time.

Implements LinuxSampler::Synchronizer< T >.

Definition at line 313 of file SynchronizedConfig.h.

◆ GetConfigForUpdate()

template<class T >
T & LinuxSampler::SynchronizedConfig< T >::GetConfigForUpdate ( )
inherited

Gets the configuration object for use by the non real time thread.

The object returned is not in use by the real time thread, so it can safely be updated. After the update is done, the non real time thread must call SwitchConfig() and the same update must be done again.

Returns
a reference to the configuration object to be updated by the non real time thread

Definition at line 158 of file SynchronizedConfig.h.

◆ GetUnsafeUpdateConfig()

template<class T >
const T & LinuxSampler::SynchronizedConfig< T >::GetUnsafeUpdateConfig ( ) const
inlineinherited

Get the data on update side for read-only access.

Definition at line 128 of file SynchronizedConfig.h.

◆ SwitchConfig()

template<class T >
T & LinuxSampler::SynchronizedConfig< T >::SwitchConfig ( )
inherited

Atomically switch the newly updated configuration object with the one used by the real time thread, then wait for the real time thread to finish working with the old object before returning the old object.

SwitchConfig() must be called by the non real time thread after an update has been done, and the object returned must be updated in the same way as the first.

Returns
a reference to the configuration object to be updated by the non real time thread

Definition at line 162 of file SynchronizedConfig.h.

References LinuxSampler::atomic_thread_fence(), LinuxSampler::memory_order_acquire, LinuxSampler::memory_order_release, and LinuxSampler::memory_order_seq_cst.

◆ syncedData()

template<class T >
virtual T & LinuxSampler::BackBuffer< T >::syncedData ( )
inlinevirtual

Retrieve reference to critical, shared data.

This method shall be called between a beginSync() and endSync() call pair, to be sure that shared data can be accessed safely.

Implements LinuxSampler::Synchronizer< T >.

Definition at line 309 of file SynchronizedConfig.h.

◆ unsafeData()

template<class T >
const T & LinuxSampler::BackBuffer< T >::unsafeData ( ) const
inline

Definition at line 319 of file SynchronizedConfig.h.


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