24 #ifndef __LIBS_BASEAPP_THREAD_MANAGER_H_ 25 #define __LIBS_BASEAPP_THREAD_MANAGER_H_ 27 #include <core/threading/thread_list.h> 28 #include <core/threading/thread_collector.h> 29 #include <core/exception.h> 30 #include <aspect/blocked_timing.h> 31 #include <aspect/blocked_timing/executor.h> 33 #include <core/utils/lock_map.h> 42 class ThreadInitializer;
43 class ThreadFinalizer;
59 add_maybelocked(tl,
true);
64 add_maybelocked(t,
true);
69 remove_maybelocked(tl,
true);
74 remove_maybelocked(t,
true);
81 unsigned int timeout_usec = 0);
84 virtual void try_recover(std::list<std::string> &recovered_threads);
93 void internal_add_thread(
Thread *t);
94 void internal_remove_thread(
Thread *t);
95 void add_maybelocked(
ThreadList &tl,
bool lock);
96 void add_maybelocked(
Thread *t,
bool lock);
97 void remove_maybelocked(
ThreadList &tl,
bool lock);
98 void remove_maybelocked(
Thread *t,
bool lock);
109 virtual void remove(
Thread *t);
128 ThreadManagerAspectCollector *__aspect_collector;
129 bool __interrupt_timed_thread_wait;
void set_inifin(ThreadInitializer *initializer, ThreadFinalizer *finalizer)
Set initializer/finalizer.
Wait until a given condition holds.
virtual void add(ThreadList &tl)
Add multiple threads.
Fawkes library namespace.
virtual ~ThreadManager()
Destructor.
virtual bool timed_threads_exist()
Check if any timed threads exist.
Thread class encapsulation of pthreads.
virtual void force_remove(ThreadList &tl)
Force removal of the given threads.
ThreadManager()
Constructor.
virtual void wait_for_timed_threads()
Wait for timed threads.
Base application thread manager.
WakeupHook
Type to define at which hook the thread is woken up.
Thread initializer interface.
virtual void add(Thread *t)
Add single thread.
virtual void wakeup(BlockedTimingAspect::WakeupHook hook, Barrier *barrier=0)
Wakeup thread for given hook.
virtual void wakeup_and_wait(BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec=0)
Wakeup thread for given hook and wait for completion.
virtual void interrupt_timed_thread_wait()
Interrupt any currently running wait_for_timed_threads() and cause it to throw an InterruptedExceptio...
virtual void try_recover(std::list< std::string > &recovered_threads)
Try to recover threads.
ThreadCollector * aspect_collector() const
Get a thread collector to be used for an aspect initializer.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
Thread finalizer interface.