~ubuntu-branches/debian/sid/ember/sid

« back to all changes in this revision

Viewing changes to src/framework/tasks/TaskExecutor.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2009-10-22 23:21:17 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20091022232117-isr8u3402qmu7ilo
Tags: 0.5.7-1
* New upstream release.
  - Compile against current ogre (Closes: #551431)
  - Removed debian/patches/ember-gcc4.4.patch. Merged upstream.
  - Updated Depends on ember-media.
* Add libboost-thread-dev tp Build-Depends.
* Make debian/rules independent from upstream version.
* Updated watch file to allow automatic download of new upstream
  tarballs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 Copyright (C) 2009 Erik Hjortsberg
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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.
 
17
 */
 
18
 
 
19
#ifndef TASKEXECUTOR_H_
 
20
#define TASKEXECUTOR_H_
 
21
 
 
22
#include <memory>
 
23
 
 
24
namespace boost
 
25
{
 
26
class thread;
 
27
}
 
28
 
 
29
namespace Ember
 
30
{
 
31
 
 
32
namespace Tasks
 
33
{
 
34
 
 
35
class TaskQueue;
 
36
 
 
37
/**
 
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).
 
41
 */
 
42
class TaskExecutor
 
43
{
 
44
        friend class TaskQueue;
 
45
public:
 
46
protected:
 
47
 
 
48
        /**
 
49
         * @brief The queue to which this executor belong.
 
50
         */
 
51
        TaskQueue& mTaskQueue;
 
52
 
 
53
        /**
 
54
         * @brief Whether the executor is active or not.
 
55
         */
 
56
        bool mActive;
 
57
 
 
58
        /**
 
59
         * @brief The thread which performs the execution.
 
60
         */
 
61
        std::auto_ptr<boost::thread> mThread;
 
62
 
 
63
        /**
 
64
         * @brief Ctor.
 
65
         * During construction a new thread will be created and executed.
 
66
         * @param taskQueue The queue to which this executor belongs.
 
67
         */
 
68
        TaskExecutor(TaskQueue& taskQueue);
 
69
 
 
70
        /**
 
71
         * @brief Dtor.
 
72
         */
 
73
        virtual ~TaskExecutor();
 
74
 
 
75
        /**
 
76
         * @brief Main loop method.
 
77
         */
 
78
        void run();
 
79
        //      void shutdown();
 
80
};
 
81
 
 
82
}
 
83
}
 
84
#endif /* TASKEXECUTOR_H_ */