Fawkes API
Fawkes Development Version
timer_thread.h
1
2
/***************************************************************************
3
* timer_thread.h - timer thread
4
*
5
* Created: Mon Aug 13 16:17:47 2018
6
* Copyright 2006-2018 Tim Niemueller [www.niemueller.de]
7
****************************************************************************/
8
9
/* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Library General Public License for more details.
18
*
19
* Read the full text in the LICENSE.GPL file in the doc directory.
20
*/
21
22
#ifndef __PLUGINS_PLEXIL_TIMER_THREAD_H_
23
#define __PLUGINS_PLEXIL_TIMER_THREAD_H_
24
25
#include <aspect/clock.h>
26
#include <core/threading/thread.h>
27
28
class
PlexilTimerThread
:
public
fawkes::Thread
29
{
30
public
:
31
PlexilTimerThread
();
32
virtual
~PlexilTimerThread
();
33
34
virtual
void
loop
();
35
36
/** Callback listener pure virtual class. */
37
class
CallbackListener
38
{
39
public
:
40
/** Called for timer events. */
41
virtual
void
timer_event
() = 0;
42
};
43
44
void
start_timer
(
CallbackListener
*listener,
const
fawkes::Time
&wait_until);
45
void
abort_timer
();
46
47
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
48
protected
:
49
virtual
void
50
run
()
51
{
52
Thread::run();
53
}
54
55
private
:
56
fawkes::Mutex
* mutex_;
57
fawkes::WaitCondition
*waitcond_;
58
59
CallbackListener *listener_;
60
fawkes::Time
queued_wait_until_;
61
bool
aborted_;
62
};
63
64
#endif
PlexilTimerThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
timer_thread.cpp:49
fawkes::Mutex
Definition:
mutex.h:36
fawkes::WaitCondition
Definition:
wait_condition.h:40
PlexilTimerThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition:
timer_thread.h:53
PlexilTimerThread::PlexilTimerThread
PlexilTimerThread()
Constructor.
Definition:
timer_thread.cpp:35
fawkes::Time
Definition:
time.h:96
PlexilTimerThread::CallbackListener
Callback listener pure virtual class.
Definition:
timer_thread.h:40
PlexilTimerThread
Definition:
timer_thread.h:27
PlexilTimerThread::CallbackListener::timer_event
virtual void timer_event()=0
Called for timer events.
fawkes::Thread
Definition:
thread.h:44
PlexilTimerThread::start_timer
void start_timer(CallbackListener *listener, const fawkes::Time &wait_until)
Start timer non-blocking.
Definition:
timer_thread.cpp:76
PlexilTimerThread::abort_timer
void abort_timer()
Abort a currently running timer.
Definition:
timer_thread.cpp:94
PlexilTimerThread::~PlexilTimerThread
virtual ~PlexilTimerThread()
Empty destructor.
Definition:
timer_thread.cpp:44
src
plugins
plexil
timer_thread.h
Generated by
1.8.16