thread_collector.cpp

00001 
00002 /***************************************************************************
00003  *  thread_collector.pp - Fawkes thread collector interface
00004  *                       based on previous ThreadManager
00005  *
00006  *  Created: Thu Jan 11 17:53:44 2007
00007  *  Copyright  2006-2007  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010 
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024 
00025 #include <core/threading/thread_collector.h>
00026 
00027 namespace fawkes {
00028 
00029 /** @class ThreadCollector core/threading/thread_collector.h
00030  * Thread collector.
00031  * This interface is meant to provide a central place where to put threads
00032  * to have them referenced somewhere. Threads my be added and removed at
00033  * will. The main purpose of the collector is to tear down all threads if
00034  * the collector is deleted thus providing a clean exit.
00035  *
00036  * Additional functionality and aspect-specific behavior may be added in
00037  * implementations.
00038  *
00039  * @author Tim Niemueller
00040  *
00041  * @fn void ThreadCollector::add(ThreadList &tl) = 0
00042  * Add multiple threads.
00043  * Adds all the threads in the list to the thread list. Implementations may
00044  * throw an exception if this fails for whatever reason, read implementation
00045  * documentation for details. The operation shall be atomic, either all
00046  * threads are added successfully or none is added at all. If adding fails
00047  * a CannotInitializeThreadException is thrown.
00048  *
00049  * The thread is started if and only if initialization of all threads suceeds.
00050  * A CannotInitializeThreadException is thrown if initialization failed for
00051  * any thread.
00052  * @param tl list of threads to add
00053  *
00054  * @fn void ThreadCollector::add(Thread *t) = 0
00055  * Add single thread.
00056  * Adds the single thread to the internal (implementation specific) thread
00057  * list. The thread is started if and only if initialization suceeds.
00058  * A CannotInitializeThreadException is thrown if initialization failed.
00059  * @param t thread to add
00060  *
00061  * @fn ThreadCollector::remove(ThreadList &tl) = 0
00062  * Remove multiple threads.
00063  * Remove all threads in the thread list from this collector. If there is
00064  * a thread in the supplied thread list that has never been collected no
00065  * error shall be thrown but this just be silently ignored.
00066  *
00067  * The threads are finalized, cancelled and joined. If the finalization fails
00068  * for whatever reason the threads are NOT cancelled or stopped.
00069  * In that case a CannotFinalizeThreadException is thrown.
00070  * @param tl list of threads to remove
00071  *
00072  * @fn ThreadCollector::remove(Thread *t) = 0
00073  * Remove single thread.
00074  * Remove the thread from the internal thread list. If the thread has never
00075  * been collected no error shall be thrown but just be silently ignored.
00076  * The thread is finalized, cancelled and joined. If the finalization fails
00077  * for whatever reason the thread is NOT cancelled or stopped. In that case
00078  * a CannotFinalizeThreadException is thrown.
00079  * @param t Thread to remove.
00080  *
00081  * @fn ThreadCollector::force_remove(ThreadList &tl) = 0
00082  * Force removal of multiple threads.
00083  * Remove all threads in the thread list from this collector. If there is
00084  * a thread in the supplied thread list that has never been collected no
00085  * error shall be thrown but this just be silently ignored.
00086  *
00087  * The threads are finalized, cancelled and joined. The result of the finalization
00088  * is ignored and the thread is cancelled and joined in any case.
00089  * @param tl list of threads to remove
00090  *
00091  * @fn ThreadCollector::force_remove(Thread *t) = 0
00092  * Force removal of a single thread.
00093  * Remove the thread from the internal thread list. If the thread has never
00094  * been collected no error shall be thrown but just be silently ignored.
00095  * The threads are finalized, cancelled and joined. The result of the finalization
00096  * is ignored and the thread is cancelled and joined in any case.
00097  * @param t Thread to remove.
00098  */
00099 
00100 /** Empty virtual destructor. */
00101 ThreadCollector::~ThreadCollector()
00102 {
00103 }
00104 
00105 
00106 } // end namespace fawkes

Generated on Tue Feb 22 13:32:26 2011 for Fawkes API by  doxygen 1.4.7