luna-sysmgr-common
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
TaskBase.h
Go to the documentation of this file.
1
/* @@@LICENSE
2
*
3
* Copyright (c) 2008-2012 Hewlett-Packard Development Company, L.P.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
* LICENSE@@@ */
31
#ifndef TASKBASE_H
32
#define TASKBASE_H
33
34
#include "
Common.h
"
35
36
#include <glib.h>
37
#include <list>
38
39
#include "
sptr.h
"
40
#include "
AsyncCaller.h
"
41
#include "
Event.h
"
42
#include "
Mutex.h
"
43
#include "
SingletonTimer.h
"
44
52
class
TaskBase
:
public
RefCounted
53
{
54
public
:
60
TaskBase
();
61
68
virtual
~TaskBase
();
69
77
virtual
void
run
() = 0;
78
85
virtual
void
quit
() = 0;
86
101
void
postEvent
(
sptr<Event>
event,
bool
highPriority=
false
);
102
114
GMainLoop*
mainLoop
()
const
{
return
m_mainLoop
; }
115
130
SingletonTimer
*
masterTimer
()
const
{
return
m_masterTimer
; }
131
132
protected
:
142
virtual
void
handleEvent
(
sptr<Event>
event) = 0;
143
149
GMainContext*
m_mainCtxt
;
150
156
GMainLoop*
m_mainLoop
;
157
163
Mutex
m_mutex
;
164
175
Mutex
m_eventsMutex
;
176
185
std::list<sptr<Event> >
m_eventsList
;
186
194
AsyncCaller<TaskBase>
*
m_asyncCaller
;
195
201
SingletonTimer
*
m_masterTimer
;
202
203
private
:
210
void
eventCallback();
211
};
212
213
#endif
/* TASKBASE_H */
luna-sysmgr-common
include
TaskBase.h
Generated on Fri Jun 21 2013 00:48:48 for luna-sysmgr-common by
1.8.3.1