Public Member Functions

fawkes::ThreadCollector Class Reference

Thread collector. More...

#include <core/threading/thread_collector.h>

Inheritance diagram for fawkes::ThreadCollector:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~ThreadCollector ()
 Empty virtual destructor.
virtual void add (ThreadList &tl)=0
 Add multiple threads.
virtual void add (Thread *t)=0
 Add single thread.
virtual void remove (ThreadList &tl)=0
 Remove multiple threads.
virtual void remove (Thread *t)=0
 Remove single thread.
virtual void force_remove (fawkes::ThreadList &tl)=0
 Force removal of multiple threads.
virtual void force_remove (fawkes::Thread *t)=0
 Force removal of a single thread.

Detailed Description

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.

Author:
Tim Niemueller

Definition at line 34 of file thread_collector.h.


Constructor & Destructor Documentation

fawkes::ThreadCollector::~ThreadCollector (  )  [virtual]

Empty virtual destructor.

Definition at line 101 of file thread_collector.cpp.


Member Function Documentation

void fawkes::ThreadCollector::add ( ThreadList tl  )  [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.

Parameters:
tl list of threads to add

Referenced by fawkes::FawkesNetworkServerThread::FawkesNetworkServerThread(), firevision::FuseServer::FuseServer(), fawkes::PluginManager::load(), and FvBaseThread::register_for_camera().

void fawkes::ThreadCollector::add ( Thread t  )  [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.

Parameters:
t thread to add
fawkes::ThreadCollector::force_remove ( fawkes::ThreadList tl  )  [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.

Parameters:
tl list of threads to remove

Referenced by fawkes::PluginManager::~PluginManager().

fawkes::ThreadCollector::force_remove ( fawkes::Thread t  )  [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.

Parameters:
t Thread to remove.
fawkes::ThreadCollector::remove ( Thread t  )  [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.

Parameters:
t Thread to remove.
fawkes::ThreadCollector::remove ( ThreadList tl  )  [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.

Parameters:
tl list of threads to remove

Referenced by fawkes::FawkesNetworkServerThread::loop(), FvBaseThread::loop(), fawkes::PluginManager::unload(), fawkes::FawkesNetworkServerThread::~FawkesNetworkServerThread(), FountainThread::~FountainThread(), and firevision::FuseServer::~FuseServer().


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