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();
~FvAqtVisionThreads()
Destructor.
void add_waiting_thread(fawkes::Thread *thread)
Add a thread in waiting state.
bool has_waiting_thread(fawkes::Thread *t)
Check if the given waiting thread is registered.
void wakeup_and_wait_cyclic_threads()
Wakeup and wait for all cyclic threads.
float empty_time()
Get the empty time.
void remove_waiting_thread(fawkes::Thread *thread)
Remove waiting thread.
void set_prepfin_hold(bool hold)
Set prepfin hold fo cyclic threads.
bool empty()
Check if there is no thread at all.
bool has_cont_thread()
Check if there is at least one continuous thread.
void remove_thread(fawkes::Thread *thread)
Remove a thread.
void set_thread_running(fawkes::Thread *thread)
Mark the thread as running.
FvAqtVisionThreads(fawkes::Clock *clock)
Constructor.
bool has_cyclic_thread()
Check if there is at least one cyclic thread.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
This is supposed to be the central clock in Fawkes.
void get_systime(struct timeval *tv) const
Returns the system time.
float elapsed(Time *t) const
How much time has elapsed since t? Calculated as "now - t" in seconds.
Base class for exceptions in Fawkes.
void remove_locked(Thread *thread)
Remove with lock protection.
void set_prepfin_hold(bool hold)
Set prepfin hold on all threads.
void wakeup()
Wakeup all threads in list.
void push_back_locked(Thread *thread)
Add thread to the end with lock protection.
Thread class encapsulation of pthreads.
Thread aspect to use in FireVision apps.
VisionThreadMode vision_thread_mode()
Get the vision thread mode of this thread.
Fawkes library namespace.