Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
finalize_nettler_thread.cpp
1
2
/***************************************************************************
3
* finalize_nettler_thread.cpp - Fawkes Example Plugin Finalize Nettler Thread
4
*
5
* Created: Thu May 24 00:35:06 2007
6
* Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#include <plugins/examples/basics/finalize_nettler_thread.h>
24
25
#include <unistd.h>
26
27
using namespace
fawkes;
28
29
/** @class ExampleFinalizeNettlerThread plugins/examples/basics/finalize_nettler_thread.h
30
* Thread of example plugin.
31
* This thread does nothing but nagging once on finalize. On the first call to
32
* prepare finalize it returns false that it cannot be finalized,
33
* on the second time it allows finalization.
34
* @author Tim Niemueller
35
*/
36
37
/** Constructor.
38
* @param name thread name
39
*/
40
ExampleFinalizeNettlerThread::ExampleFinalizeNettlerThread
(
const
char
*name)
41
:
Thread
(name,
Thread
::OPMODE_WAITFORWAKEUP)
42
{
43
nagged =
false
;
44
}
45
46
47
/** Destructor. */
48
ExampleFinalizeNettlerThread::~ExampleFinalizeNettlerThread
()
49
{
50
}
51
52
53
/** Thread loop.
54
* If num iterations module modc is 0 print out messaege, otherwise do nothing.
55
*/
56
void
57
ExampleFinalizeNettlerThread::loop
()
58
{
59
}
60
61
62
void
63
ExampleFinalizeNettlerThread::init
()
64
{
65
logger
->
log_info
(
"ExampleFinalizeNettlerThread"
,
"init() called"
);
66
}
67
68
69
void
70
ExampleFinalizeNettlerThread::finalize
()
71
{
72
logger
->
log_info
(
"ExampleFinalizeNettlerThread"
,
"finalize() called"
);
73
}
74
75
76
bool
77
ExampleFinalizeNettlerThread::prepare_finalize_user
()
78
{
79
if
( nagged ) {
80
logger
->
log_warn
(
"ExampleFinalizeNettlerThread"
,
"Allowing Finalization"
);
81
return
true
;
82
}
else
{
83
logger
->
log_warn
(
"ExampleFinalizeNettlerThread"
,
"NOT allowing Finalization"
);
84
nagged =
true
;
85
return
false
;
86
}
87
}
src
plugins
examples
basics
finalize_nettler_thread.cpp
Generated by
1.8.1.1