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);
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);
125 Thread *__mainloop_thread;
126 Mutex *__mainloop_mutex;
129 char *__default_plugin;
130 char *__load_plugins;
135 Mutex *__plugin_mutex;
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;
void full_start()
Start the thread and wait until once() completes.
Configuration storage using SQLite.
Interface for logging to network clients.
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.
Aspect and aspect initializer/finalizer manager.
Runner(FawkesMainThread *fmt, bool register_signals=true)
Constructor.
Main loop employer The MainLoopEmployer calls the main loop for execution.
MultiLogger * logger() const
Get logger.
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.
FawkesMainThread(SQLiteConfiguration *config, MultiLogger *multi_logger, ThreadManager *thread_manager, PluginManager *plugin_manager, const char *load_plugins, const char *default_plugin=0)
Constructor.
Mutex mutual exclusion lock.
Fawkes default main thread.
Interface for configuration handling.
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.