1 /***************************************************************************
3 * Copyright (C) 2006 David Brodsky *
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. *
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. *
15 ***************************************************************************/
17 #ifndef _main_hashcheckerthread_h
18 #define _main_hashcheckerthread_h
22 #include <tairon/core/thread.h>
34 }; // namespace Tairon
44 /** \brief Thread for hash checking.
46 class HashCheckerThread
: public Tairon::Core::Thread
49 /** Constructs a HashCheckerThread object. It is still needed to call
50 * start() method to run the thread.
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.
66 /** Returns pointer to the instance of this class.
68 static HashCheckerThread
*self() {
69 return hashCheckerThread
;
72 /** Stops the thread's loop.
79 /** Mutex for locking toDelete list.
81 Tairon::Core::Mutex
*deletingMutex
;
83 /** Whether this thread should 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
;
98 }; // namespace Tairent
102 // vim: ai sw=4 ts=4 noet fdm=marker