2
Copyright (C) 2009 Erik Hjortsberg
4
This program is free software; you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
#ifndef TASKEXECUTOR_H_
20
#define TASKEXECUTOR_H_
38
* @author Erik Hjortsberg <erik.hjortsberg@gmail.com>
39
* @brief A task executor, responsible for processing tasks.
40
* Each instance of this holds a thread. It's only purpose is to ask the queue for new tasks to process. If no tasks are available it will sleep (inside of TaskQueue::fetchNextTask).
44
friend class TaskQueue;
49
* @brief The queue to which this executor belong.
51
TaskQueue& mTaskQueue;
54
* @brief Whether the executor is active or not.
59
* @brief The thread which performs the execution.
61
std::auto_ptr<boost::thread> mThread;
65
* During construction a new thread will be created and executed.
66
* @param taskQueue The queue to which this executor belongs.
68
TaskExecutor(TaskQueue& taskQueue);
73
virtual ~TaskExecutor();
76
* @brief Main loop method.
84
#endif /* TASKEXECUTOR_H_ */