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>
43 class SQLiteConfiguration;
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;
119 NetworkLogger *__network_logger;
121 TimeWait *__time_wait;
122 AspectManager *__aspect_manager;
124 Barrier *__init_barrier;
125 Thread *__mainloop_thread;
126 Mutex *__mainloop_mutex;
127 InterruptibleBarrier *__mainloop_barrier;
129 char *__default_plugin;
130 char *__load_plugins;
132 SQLiteConfiguration *__sqlite_conf;
133 ThreadManager *__thread_manager;
134 PluginManager *__plugin_manager;
135 Mutex *__plugin_mutex;
136 FawkesNetworkManager *__network_manager;
138 std::list<std::string> __recovered_threads;
139 unsigned int __desired_loop_time_usec;
140 float __desired_loop_time_sec;
141 unsigned int __max_thread_time_usec;
142 unsigned int __max_thread_time_nanosec;
145 bool __enable_looptime_warnings;
Configuration storage using SQLite.
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.
Utility class to run the main thread.