24 #ifndef __LIBS_BASEAPP_MAIN_THREAD_H_ 25 #define __LIBS_BASEAPP_MAIN_THREAD_H_ 27 #include <baseapp/thread_manager.h> 28 #include <core/threading/thread.h> 29 #include <aspect/mainloop/employer.h> 30 #include <aspect/blocked_timing.h> 31 #include <utils/system/signal.h> 32 #include <logging/multi.h> 44 class ConfigNetworkHandler;
51 class PluginNetworkHandler;
52 class InterruptibleBarrier;
56 class FawkesNetworkManager;
67 const char *load_plugins,
68 const char *default_plugin = 0);
91 bool __sigint_running;
92 bool __register_signals;
104 __thread_manager->wakeup_and_wait(hook, timeout_usec);
106 if (__enable_looptime_warnings) {
110 __multi_logger->log_error(
"FawkesMainThread", e);
123 Thread *__mainloop_thread;
124 Mutex *__mainloop_mutex;
127 char *__default_plugin;
128 char *__load_plugins;
133 std::list<std::string> __recovered_threads;
134 unsigned int __desired_loop_time_usec;
135 float __desired_loop_time_sec;
136 unsigned int __max_thread_time_usec;
137 unsigned int __max_thread_time_nanosec;
140 bool __enable_looptime_warnings;
void full_start()
Start the thread and wait until once() completes.
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
This is supposed to be the central clock in Fawkes.
Interface for signal handling.
A class for handling time.
Thread class encapsulation of pthreads.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void loop()
Code to execute in the thread.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
Log through multiple loggers.
virtual ~FawkesMainThread()
Destructor.
Base application thread manager.
WakeupHook
Type to define at which hook the thread is woken up.
Base class for exceptions in Fawkes.
Runner(FawkesMainThread *fmt, bool register_signals=true)
Constructor.
Main loop employer The MainLoopEmployer calls the main loop for execution.
void run()
Run main thread.
virtual void set_mainloop_thread(Thread *mainloop_thread)
Set a new main loop.
void handle_signal(int signum)
Handle signals.
MultiLogger * logger() const
Get logger.
Mutex mutual exclusion lock.
Fawkes default main thread.
Interface for configuration handling.
FawkesMainThread(Configuration *config, MultiLogger *multi_logger, ThreadManager *thread_manager, PluginManager *plugin_manager, const char *load_plugins, const char *default_plugin=0)
Constructor.
A barrier is a synchronization tool which blocks until a given number of threads have reached the bar...
Utility class to run the main thread.
virtual void once()
Execute an action exactly once.