Fawkes API
Fawkes Development Version
|
23 #include "aqt_vision_threads.h"
25 #include <aspect/vision.h>
26 #include <core/threading/barrier.h>
27 #include <utils/time/clock.h>
44 : cyclic_barrier(new
Barrier(1)), clock(clock)
72 if (find(waiting_threads.begin(), waiting_threads.end(), thread) != waiting_threads.end()) {
75 cyclic_barrier.reset(
new Barrier(running_threads_cyclic.size() + 1));
91 if (find(running_threads_cyclic.begin(), running_threads_cyclic.end(), thread)
92 != running_threads_cyclic.end()) {
95 cyclic_barrier.reset(
new Barrier(running_threads_cyclic.size() + 1));
121 return (!running_threads_cyclic.empty());
130 return (!running_threads_cont.empty());
140 return (find(waiting_threads.begin(), waiting_threads.end(), t) != waiting_threads.end());
150 return (waiting_threads.empty() && running_threads_cyclic.empty()
151 && running_threads_cont.empty());
160 return clock->
elapsed(&_empty_time);
168 running_threads_cyclic.
wakeup(&*cyclic_barrier);
169 cyclic_barrier->wait();
void wakeup()
Wakeup all threads in list.
bool has_waiting_thread(fawkes::Thread *t)
Check if the given waiting thread is registered.
VisionThreadMode vision_thread_mode()
Get the vision thread mode of this thread.
~FvAqtVisionThreads()
Destructor.
bool has_cont_thread()
Check if there is at least one continuous thread.
void remove_waiting_thread(fawkes::Thread *thread)
Remove waiting thread.
bool empty()
Check if there is no thread at all.
float elapsed(Time *t) const
How much time has elapsed since t? Calculated as "now - t" in seconds.
void remove_thread(fawkes::Thread *thread)
Remove a thread.
void set_prepfin_hold(bool hold)
Set prepfin hold on all threads.
FvAqtVisionThreads(fawkes::Clock *clock)
Constructor.
void set_prepfin_hold(bool hold)
Set prepfin hold fo cyclic threads.
void add_waiting_thread(fawkes::Thread *thread)
Add a thread in waiting state.
Fawkes library namespace.
void set_thread_running(fawkes::Thread *thread)
Mark the thread as running.
bool has_cyclic_thread()
Check if there is at least one cyclic thread.
void get_systime(struct timeval *tv) const
Returns the system time.
void remove_locked(Thread *thread)
Remove with lock protection.
Thread class encapsulation of pthreads.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
float empty_time()
Get the empty time.
void wakeup_and_wait_cyclic_threads()
Wakeup and wait for all cyclic threads.
void push_back_locked(Thread *thread)
Add thread to the end with lock protection.
This is supposed to be the central clock in Fawkes.
Thread aspect to use in FireVision apps.
Base class for exceptions in Fawkes.