Fawkes API
Fawkes Development Version
|
Aspect for thread producing threads. More...
#include <>>
Public Member Functions | |
ThreadProducerAspect () | |
Constructor. More... | |
virtual | ~ThreadProducerAspect () |
Virtual empty destructor. More... | |
void | init_ThreadProducerAspect (ThreadCollector *collector) |
Init thread producer aspect. More... | |
![]() | |
const std::list< const char * > & | get_aspects () const |
Get list of aspect names attached to a aspected thread. More... | |
Protected Attributes | |
ThreadCollector * | thread_collector |
Thread collector. More... | |
Additional Inherited Members | |
![]() | |
void | add_aspect (const char *name) |
Add an aspect to a thread. More... | |
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!
Definition at line 35 of file thread_producer.h.
fawkes::ThreadProducerAspect::ThreadProducerAspect | ( | ) |
Constructor.
Definition at line 64 of file thread_producer.cpp.
References fawkes::Aspect::add_aspect().
|
virtual |
Virtual empty destructor.
Definition at line 70 of file thread_producer.cpp.
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).
collector | thread collector |
Definition at line 82 of file thread_producer.cpp.
References thread_collector.
Referenced by fawkes::ThreadProducerAspectIniFin::init().
|
protected |
Thread collector.
Use this thread collector to register/unregister threads as they are created/deleted. It is set when the thread starts.
Definition at line 44 of file thread_producer.h.
Referenced by FountainThread::finalize(), FvBaseThread::finalize(), LuaAgentContinuousExecutionThread::finalize(), FountainThread::init(), LuaAgentContinuousExecutionThread::init(), init_ThreadProducerAspect(), FvBaseThread::loop(), LuaAgentContinuousExecutionThread::loop(), FvBaseThread::register_for_camera(), and FountainThread::~FountainThread().