Fawkes API
Fawkes Development Version
|
#include <core/threading/thread_collector.h>
Public Member Functions | |
virtual | ~ThreadCollector () |
Empty virtual destructor. More... | |
virtual void | add (ThreadList &tl)=0 |
Add multiple threads. More... | |
virtual void | add (Thread *t)=0 |
Add single thread. More... | |
virtual void | remove (ThreadList &tl)=0 |
Remove multiple threads. More... | |
virtual void | remove (Thread *t)=0 |
Remove single thread. More... | |
virtual void | force_remove (fawkes::ThreadList &tl)=0 |
Force removal of multiple threads. More... | |
virtual void | force_remove (fawkes::Thread *t)=0 |
Force removal of a single thread. More... | |
Thread collector.
This interface is meant to provide a central place where to put threads to have them referenced somewhere. Threads my be added and removed at will. The main purpose of the collector is to tear down all threads if the collector is deleted thus providing a clean exit.
Additional functionality and aspect-specific behavior may be added in implementations.
Definition at line 34 of file thread_collector.h.
|
virtual |
Empty virtual destructor.
Definition at line 101 of file thread_collector.cpp.
|
pure virtual |
Add multiple threads.
Adds all the threads in the list to the thread list. Implementations may throw an exception if this fails for whatever reason, read implementation documentation for details. The operation shall be atomic, either all threads are added successfully or none is added at all. If adding fails a CannotInitializeThreadException is thrown.
The thread is started if and only if initialization of all threads suceeds. A CannotInitializeThreadException is thrown if initialization failed for any thread.
tl | list of threads to add |
Implemented in fawkes::ThreadManager.
Referenced by firevision::FuseServer::add_connection(), fawkes::FawkesNetworkServerThread::add_connection(), fawkes::FawkesNetworkManager::FawkesNetworkManager(), fawkes::FawkesNetworkServerThread::FawkesNetworkServerThread(), firevision::FuseServer::FuseServer(), FountainThread::init(), LuaAgentContinuousExecutionThread::init(), fawkes::PluginManager::load(), and FvBaseThread::register_for_camera().
|
pure virtual |
Add single thread.
Adds the single thread to the internal (implementation specific) thread list. The thread is started if and only if initialization suceeds. A CannotInitializeThreadException is thrown if initialization failed.
t | thread to add |
Implemented in fawkes::ThreadManager.
|
pure virtual |
Force removal of multiple threads.
Remove all threads in the thread list from this collector. If there is a thread in the supplied thread list that has never been collected no error shall be thrown but this just be silently ignored.
The threads are finalized, cancelled and joined. The result of the finalization is ignored and the thread is cancelled and joined in any case.
tl | list of threads to remove |
Implemented in fawkes::ThreadManager.
Referenced by fawkes::PluginManager::~PluginManager().
|
pure virtual |
Force removal of a single thread.
Remove the thread from the internal thread list. If the thread has never been collected no error shall be thrown but just be silently ignored. The threads are finalized, cancelled and joined. The result of the finalization is ignored and the thread is cancelled and joined in any case.
t | Thread to remove. |
Implemented in fawkes::ThreadManager.
|
pure virtual |
Remove multiple threads.
Remove all threads in the thread list from this collector. If there is a thread in the supplied thread list that has never been collected no error shall be thrown but this just be silently ignored.
The threads are finalized, cancelled and joined. If the finalization fails for whatever reason the threads are NOT cancelled or stopped. In that case a CannotFinalizeThreadException is thrown.
tl | list of threads to remove |
Implemented in fawkes::ThreadManager.
Referenced by FountainThread::finalize(), FvBaseThread::finalize(), LuaAgentContinuousExecutionThread::finalize(), fawkes::FawkesNetworkServerThread::loop(), firevision::FuseServer::loop(), FvBaseThread::loop(), LuaAgentContinuousExecutionThread::loop(), fawkes::PluginManager::unload(), fawkes::FawkesNetworkManager::~FawkesNetworkManager(), fawkes::FawkesNetworkServerThread::~FawkesNetworkServerThread(), FountainThread::~FountainThread(), and firevision::FuseServer::~FuseServer().
|
pure virtual |
Remove single thread.
Remove the thread from the internal thread list. If the thread has never been collected no error shall be thrown but just be silently ignored. The thread is finalized, cancelled and joined. If the finalization fails for whatever reason the thread is NOT cancelled or stopped. In that case a CannotFinalizeThreadException is thrown.
t | Thread to remove. |
Implemented in fawkes::ThreadManager.