Fawkes API
Fawkes Development Version
|
22 #include "timer_thread.h"
24 #include <core/threading/mutex.h>
25 #include <core/threading/mutex_locker.h>
26 #include <core/threading/wait_condition.h>
54 while (!queued_wait_until_.
is_zero()) {
61 woken = waitcond_->
abstimed_wait(wait_until.get_sec(), wait_until.get_nsec());
62 }
while (woken && !aborted_);
82 queued_wait_until_ = wait_until;
87 queued_wait_until_ = wait_until;
virtual void loop()
Code to execute in the thread.
void lock()
Lock this mutex.
void set_time(const timeval *tv)
Sets the time.
Mutex mutual exclusion lock.
Wait until a given condition holds.
void wakeup()
Wake up thread.
PlexilTimerThread()
Constructor.
void unlock()
Unlock the mutex.
bool abstimed_wait(long int sec, long int nanosec)
Wait with absolute timeout.
Fawkes library namespace.
bool is_zero() const
Check if time is zero.
void wake_all()
Wake up all waiting threads.
A class for handling time.
Callback listener pure virtual class.
virtual void timer_event()=0
Called for timer events.
Thread class encapsulation of pthreads.
void start_timer(CallbackListener *listener, const fawkes::Time &wait_until)
Start timer non-blocking.
void unlock()
Unlock the mutex.
void abort_timer()
Abort a currently running timer.
bool waiting() const
Check if thread is currently waiting for wakeup.
virtual ~PlexilTimerThread()
Empty destructor.