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);
74 virtual void set_mainloop_thread(
Thread *mainloop_thread);
85 void handle_signal(
int signum);
91 bool __sigint_running;
92 bool __register_signals;
96 protected:
virtual void run() { Thread::run(); }
104 __thread_manager->wakeup_and_wait(hook, timeout_usec);
105 }
catch (Exception &e) {
106 if (__enable_looptime_warnings) {
110 __multi_logger->log_error(
"FawkesMainThread", e);
117 Configuration *__config;
118 MultiLogger *__multi_logger;
120 TimeWait *__time_wait;
122 Barrier *__init_barrier;
123 Thread *__mainloop_thread;
124 Mutex *__mainloop_mutex;
125 InterruptibleBarrier *__mainloop_barrier;
127 char *__default_plugin;
128 char *__load_plugins;
130 ThreadManager *__thread_manager;
131 PluginManager *__plugin_manager;
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;
Fawkes library namespace.
Interface for signal handling.
Thread class encapsulation of pthreads.
virtual void run()
Stub to see name in backtrace for easier debugging.
Log through multiple loggers.
Base application thread manager.
WakeupHook
Type to define at which hook the thread is woken up.
Main loop employer The MainLoopEmployer calls the main loop for execution.
Mutex mutual exclusion lock.
Fawkes default main thread.
Interface for configuration handling.
Utility class to run the main thread.