Fawkes API
Fawkes Development Version
|
24 #ifndef _LIBS_BASEAPP_THREAD_MANAGER_H_
25 #define _LIBS_BASEAPP_THREAD_MANAGER_H_
27 #include <aspect/blocked_timing.h>
28 #include <aspect/blocked_timing/executor.h>
29 #include <core/exception.h>
30 #include <core/threading/thread_collector.h>
31 #include <core/threading/thread_list.h>
32 #include <core/utils/lock_map.h>
39 class ThreadInitializer;
40 class ThreadFinalizer;
42 class ThreadManager :
public ThreadCollector,
public BlockedTimingExecutor
46 ThreadManager(ThreadInitializer *initializer, ThreadFinalizer *finalizer);
54 add_maybelocked(tl,
true);
60 add_maybelocked(t,
true);
66 remove_maybelocked(tl,
true);
72 remove_maybelocked(t,
true);
80 virtual void try_recover(std::list<std::string> &recovered_threads);
89 void internal_add_thread(
Thread *t);
90 void internal_remove_thread(
Thread *t);
91 void add_maybelocked(
ThreadList &tl,
bool lock);
92 void add_maybelocked(
Thread *t,
bool lock);
93 void remove_maybelocked(
ThreadList &tl,
bool lock);
94 void remove_maybelocked(
Thread *t,
bool lock);
124 ThreadManagerAspectCollector *aspect_collector_;
125 bool interrupt_timed_thread_wait_;
virtual void try_recover(std::list< std::string > &recovered_threads)
virtual bool timed_threads_exist()
void set_inifin(ThreadInitializer *initializer, ThreadFinalizer *finalizer)
Set initializer/finalizer.
virtual void wait_for_timed_threads()
virtual ~ThreadManager()
Destructor.
virtual void wakeup_and_wait(BlockedTimingAspect::WakeupHook hook, unsigned int timeout_usec=0)
virtual void force_remove(ThreadList &tl)
Force removal of the given threads.
ThreadManager()
Constructor.
ThreadCollector * aspect_collector() const
Get a thread collector to be used for an aspect initializer.
WakeupHook
Type to define at which hook the thread is woken up.
virtual void wakeup(BlockedTimingAspect::WakeupHook hook, Barrier *barrier=0)
virtual void add(ThreadList &tl)
virtual void interrupt_timed_thread_wait()
virtual void remove(ThreadList &tl)