Fawkes API Fawkes Development Version
fawkes::SyncPointManager Class Reference

This class gives access to SyncPoints. More...

#include <>>

Public Member Functions

 SyncPointManager (MultiLogger *logger)
 Constructor. More...
 
RefPtr< SyncPointget_syncpoint (const std::string &component, const std::string &identifier)
 Get a SyncPoint. More...
 
void release_syncpoint (const std::string &component, RefPtr< SyncPoint > syncpoint)
 Release a SyncPoint. More...
 
std::set< RefPtr< SyncPoint >, SyncPointSetLessThanget_syncpoints ()
 Get the current list of all SyncPoints managed by this SyncPointManager. More...
 

Protected Attributes

std::set< RefPtr< SyncPoint >, SyncPointSetLessThansyncpoints_
 Set of all existing SyncPoints. More...
 
Mutexmutex_
 Mutex used for all SyncPointManager calls. More...
 

Detailed Description

This class gives access to SyncPoints.

SyncPoints should never be created directly but always by using this class.

All threads with the SyncPointManager Aspect share the same SyncPointManager. SyncPointManager provides basic methods to get and release shared SyncPoints

Author
Till Hofmann
See also
SyncPoint

Definition at line 37 of file syncpoint_manager.h.

Constructor & Destructor Documentation

◆ SyncPointManager()

fawkes::SyncPointManager::SyncPointManager ( MultiLogger logger)

Constructor.

Parameters
loggerthe logger to use for logging messages

Definition at line 46 of file syncpoint_manager.cpp.

◆ ~SyncPointManager()

fawkes::SyncPointManager::~SyncPointManager ( )
virtual

Definition at line 50 of file syncpoint_manager.cpp.

Member Function Documentation

◆ get_syncpoint()

RefPtr< SyncPoint > fawkes::SyncPointManager::get_syncpoint ( const std::string &  component,
const std::string &  identifier 
)

Get a SyncPoint.

This allows accessing the SyncPoint's wait() and emit() methods. This function creates a SyncPoint with the given identifier if it does not exist yet and constructs its predecessor.

Parameters
componentThe name of the component calling the method
identifierThe identifier of the requested SyncPoint
Returns
A RefPtr to a SyncPoint which is shared by all threads with this SyncPoint.
Exceptions
SyncPointInvalidComponentExceptionthrown if component name is invalid
SyncPointAlreadyOpenedExceptionthrown if SyncPoint is already opened by the component

Definition at line 68 of file syncpoint_manager.cpp.

References mutex_.

Referenced by Emitter::Emitter(), fawkes::FawkesTimingThread::init(), fawkes::SyncPointAspect::init_SyncPointAspect(), and fawkes::FawkesMainThread::once().

◆ get_syncpoints()

std::set< RefPtr< SyncPoint >, SyncPointSetLessThan > fawkes::SyncPointManager::get_syncpoints ( )

Get the current list of all SyncPoints managed by this SyncPointManager.

Returns
a set of SyncPoints

Definition at line 115 of file syncpoint_manager.cpp.

References mutex_, and syncpoints_.

◆ release_syncpoint()

void fawkes::SyncPointManager::release_syncpoint ( const std::string &  component,
RefPtr< SyncPoint sync_point 
)

Release a SyncPoint.

After releasing the SyncPoint, its wait() and emit() methods cannot be called anymore by the releasing component. This also releases the SyncPoint's predecessor if existent.

Parameters
componentThe releasing component
sync_pointA RefPtr to the released SyncPoint
Exceptions
SyncPointReleasedDoesNotExistExceptionthrown if the SyncPoint doesn't exist, i.e. is not in the list of the manager's SyncPoints.
SyncPointReleasedByNonWatcherExceptionThe releasing component is not a watcher of the SyncPoint

Definition at line 86 of file syncpoint_manager.cpp.

References mutex_.

Referenced by fawkes::FawkesTimingThread::finalize(), fawkes::SyncPointAspect::finalize_SyncPointAspect(), and Emitter::~Emitter().

Member Data Documentation

◆ mutex_

Mutex* fawkes::SyncPointManager::mutex_
protected

Mutex used for all SyncPointManager calls.

Definition at line 52 of file syncpoint_manager.h.

Referenced by get_syncpoint(), get_syncpoints(), and release_syncpoint().

◆ syncpoints_

std::set<RefPtr<SyncPoint>, SyncPointSetLessThan> fawkes::SyncPointManager::syncpoints_
protected

Set of all existing SyncPoints.

Definition at line 50 of file syncpoint_manager.h.

Referenced by get_syncpoints().


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