Add main page for Doxygen generated documentation.
[tairent.git] / src / main / hashcheckerthread.h
blobb0f7d145c6b65cb93f75a891a33118d3d445c7a2
1 /***************************************************************************
2 * *
3 * Copyright (C) 2006 David Brodsky *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License as *
7 * published by the Free Software Foundation and appearing *
8 * in the file LICENSE.GPL included in the packaging of this file. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13 * General Public License for more details. *
14 * *
15 ***************************************************************************/
17 #ifndef _main_hashcheckerthread_h
18 #define _main_hashcheckerthread_h
20 #include <list>
22 #include <tairon/core/thread.h>
24 namespace Tairon
27 namespace Core
30 class Mutex;
32 }; // namespace Core
34 }; // namespace Tairon
36 namespace Tairent
39 namespace Main
42 class HashChecker;
44 /** \brief Thread for hash checking.
46 class HashCheckerThread : public Tairon::Core::Thread
48 public:
49 /** Constructs a HashCheckerThread object. It is still needed to call
50 * start() method to run the thread.
52 HashCheckerThread();
54 /** Destroys the thread.
56 virtual ~HashCheckerThread();
58 /** Adds a checker to the queue of checkers scheduled for deletion.
60 void addCheckerToDelete(HashChecker *checker);
62 /** Main thread's loop. Just delivers signals to HashChecker objects.
64 virtual void *run();
66 /** Returns pointer to the instance of this class.
68 static HashCheckerThread *self() {
69 return hashCheckerThread;
72 /** Stops the thread's loop.
74 void stop() {
75 exit = true;
78 private:
79 /** Mutex for locking toDelete list.
81 Tairon::Core::Mutex *deletingMutex;
83 /** Whether this thread should exit.
85 bool exit;
87 /** Pointer to the instance of this class.
89 static HashCheckerThread *hashCheckerThread;
91 /** List of checkers that should be deleted.
93 std::list<HashChecker *> toDelete;
96 }; // namespace Main
98 }; // namespace Tairent
100 #endif
102 // vim: ai sw=4 ts=4 noet fdm=marker