Fawkes API Fawkes Development Version
thread_collector.cpp
1
2/***************************************************************************
3 * thread_collector.pp - Fawkes thread collector interface
4 * based on previous ThreadManager
5 *
6 * Created: Thu Jan 11 17:53:44 2007
7 * Copyright 2006-2007 Tim Niemueller [www.niemueller.de]
8 *
9 ****************************************************************************/
10
11/* This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. A runtime exception applies to
15 * this software (see LICENSE.GPL_WRE file mentioned below for details).
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Library General Public License for more details.
21 *
22 * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23 */
24
25#include <core/threading/thread_collector.h>
26
27namespace fawkes {
28
29/** @class ThreadCollector core/threading/thread_collector.h
30 * Thread collector.
31 * This interface is meant to provide a central place where to put threads
32 * to have them referenced somewhere. Threads my be added and removed at
33 * will. The main purpose of the collector is to tear down all threads if
34 * the collector is deleted thus providing a clean exit.
35 *
36 * Additional functionality and aspect-specific behavior may be added in
37 * implementations.
38 *
39 * @author Tim Niemueller
40 *
41 * @fn void ThreadCollector::add(ThreadList &tl) = 0
42 * Add multiple threads.
43 * Adds all the threads in the list to the thread list. Implementations may
44 * throw an exception if this fails for whatever reason, read implementation
45 * documentation for details. The operation shall be atomic, either all
46 * threads are added successfully or none is added at all. If adding fails
47 * a CannotInitializeThreadException is thrown.
48 *
49 * The thread is started if and only if initialization of all threads suceeds.
50 * A CannotInitializeThreadException is thrown if initialization failed for
51 * any thread.
52 * @param tl list of threads to add
53 *
54 * @fn void ThreadCollector::add(Thread *t) = 0
55 * Add single thread.
56 * Adds the single thread to the internal (implementation specific) thread
57 * list. The thread is started if and only if initialization suceeds.
58 * A CannotInitializeThreadException is thrown if initialization failed.
59 * @param t thread to add
60 *
61 * @fn ThreadCollector::remove(ThreadList &tl) = 0
62 * Remove multiple threads.
63 * Remove all threads in the thread list from this collector. If there is
64 * a thread in the supplied thread list that has never been collected no
65 * error shall be thrown but this just be silently ignored.
66 *
67 * The threads are finalized, cancelled and joined. If the finalization fails
68 * for whatever reason the threads are NOT cancelled or stopped.
69 * In that case a CannotFinalizeThreadException is thrown.
70 * @param tl list of threads to remove
71 *
72 * @fn ThreadCollector::remove(Thread *t) = 0
73 * Remove single thread.
74 * Remove the thread from the internal thread list. If the thread has never
75 * been collected no error shall be thrown but just be silently ignored.
76 * The thread is finalized, cancelled and joined. If the finalization fails
77 * for whatever reason the thread is NOT cancelled or stopped. In that case
78 * a CannotFinalizeThreadException is thrown.
79 * @param t Thread to remove.
80 *
81 * @fn ThreadCollector::force_remove(ThreadList &tl) = 0
82 * Force removal of multiple threads.
83 * Remove all threads in the thread list from this collector. If there is
84 * a thread in the supplied thread list that has never been collected no
85 * error shall be thrown but this just be silently ignored.
86 *
87 * The threads are finalized, cancelled and joined. The result of the finalization
88 * is ignored and the thread is cancelled and joined in any case.
89 * @param tl list of threads to remove
90 *
91 * @fn ThreadCollector::force_remove(Thread *t) = 0
92 * Force removal of a single thread.
93 * Remove the thread from the internal thread list. If the thread has never
94 * been collected no error shall be thrown but just be silently ignored.
95 * The threads are finalized, cancelled and joined. The result of the finalization
96 * is ignored and the thread is cancelled and joined in any case.
97 * @param t Thread to remove.
98 */
99
100/** Empty virtual destructor. */
102{
103}
104
105} // end namespace fawkes
virtual ~ThreadCollector()
Empty virtual destructor.
Fawkes library namespace.