Add main page for Doxygen generated documentation.
[tairent.git] / src / main / hashcheckerthread.cpp
blobf1b6a43f950cbf41f90ae8f3aa0aa86db3772569
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 #include <tairon/core/mutex.h>
19 #include "hashcheckerthread.h"
21 #include "hashchecker.h"
23 namespace Tairent
26 namespace Main
29 HashCheckerThread *HashCheckerThread::hashCheckerThread = 0;
31 /* {{{ HashCheckerThread::HashCheckerThread() */
32 HashCheckerThread::HashCheckerThread() : Tairon::Core::Thread("hash"), exit(false)
34 deletingMutex = new Tairon::Core::Mutex();
35 hashCheckerThread = this;
37 /* }}} */
39 /* {{{ HashCheckerThread::~HashCheckerThread() */
40 HashCheckerThread::~HashCheckerThread()
42 delete deletingMutex;
43 hashCheckerThread = 0;
45 /* }}} */
47 /* {{{ HashCheckerThread::addCheckerToDelete(HashChecker *) */
48 void HashCheckerThread::addCheckerToDelete(HashChecker *checker)
50 deletingMutex->lock();
51 toDelete.push_back(checker);
52 deletingMutex->unlock();
54 /* }}} */
56 /* {{{ HashCheckerThread::run() */
57 void *HashCheckerThread::run()
59 while (!exit) {
60 waitAndCallFunctors(1, 0);
61 deletingMutex->lock();
62 for (std::list<HashChecker *>::const_iterator it = toDelete.begin(); it != toDelete.end(); ++it)
63 delete *it;
64 toDelete.clear();
65 deletingMutex->unlock();
68 return 0;
70 /* }}} */
72 }; // namespace Main
74 }; // namespace Tairent
76 // vim: ai sw=4 ts=4 noet fdm=marker