Fawkes API  Fawkes Development Version
fawkes::ThreadProducerAspect Class Reference

Aspect for thread producing threads. More...

#include <>>

Inheritance diagram for fawkes::ThreadProducerAspect:

Public Member Functions

 ThreadProducerAspect ()
 Constructor. More...
 
virtual ~ThreadProducerAspect ()
 Virtual empty destructor. More...
 
void init_ThreadProducerAspect (ThreadCollector *collector)
 Init thread producer aspect. More...
 
- Public Member Functions inherited from fawkes::Aspect
const std::list< const char * > & get_aspects () const
 Get list of aspect names attached to a aspected thread. More...
 

Protected Attributes

ThreadCollectorthread_collector
 Thread collector. More...
 

Additional Inherited Members

- Protected Member Functions inherited from fawkes::Aspect
void add_aspect (const char *name)
 Add an aspect to a thread. More...
 

Detailed Description

Aspect for thread producing threads.

Some threads have to be started by a plugin after it is loaded. Thus they produce threads while they run. They may also stop this thread at any one time. To have all these threads registered with a central instance for easier instrumentation and performance assessment these threads should be registered with a central thread collector.

Additionally the threads that are produced can have aspects that are then initialized by the thread collector (if running inside Fawkes). Note that initializing an aspect may fail and then an exception is thrown to indicate the error. You have to catch this exception and you may never start a thread in that case or unpredictable behavior will happen.

This is possible with the ThreadProducerAspect. With this aspect you get access to a thread collector instance to register threads with.

Remember to unregister the produced threads if they are cancelled, joined or even deleted!

Author
Tim Niemueller

Definition at line 35 of file thread_producer.h.

Constructor & Destructor Documentation

◆ ThreadProducerAspect()

fawkes::ThreadProducerAspect::ThreadProducerAspect ( )

Constructor.

Definition at line 64 of file thread_producer.cpp.

References fawkes::Aspect::add_aspect().

◆ ~ThreadProducerAspect()

fawkes::ThreadProducerAspect::~ThreadProducerAspect ( )
virtual

Virtual empty destructor.

Definition at line 70 of file thread_producer.cpp.

Member Function Documentation

◆ init_ThreadProducerAspect()

void fawkes::ThreadProducerAspect::init_ThreadProducerAspect ( ThreadCollector collector)

Init thread producer aspect.

This set the thread collector. It is guaranteed that this is called for a thread with the ThreadProducerAspect before start is called (when running regularly inside Fawkes).

Parameters
collectorthread collector

Definition at line 82 of file thread_producer.cpp.

References thread_collector.

Referenced by fawkes::ThreadProducerAspectIniFin::init().

Member Data Documentation

◆ thread_collector

ThreadCollector * fawkes::ThreadProducerAspect::thread_collector
protected

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