24 #include <aspect/blocked_timing/executor.h>
25 #include <aspect/inifins/mainloop.h>
26 #include <aspect/mainloop.h>
27 #include <aspect/mainloop/employer.h>
28 #include <core/threading/thread_finalizer.h>
54 if (mainloop_thread == NULL) {
56 "MainLoopAspect, but RTTI says it "
63 "in wait-for-wakeup mode.");
67 mainloop_uc_.add(mainloop_thread);
82 if (mainloop_thread == NULL) {
84 "MainLoopAspect, but RTTI says it "
91 mainloop_uc_.remove(mainloop_thread);
103 if ((mainloop_thread =
dynamic_cast<MainLoopAspect *
>(thread)) != NULL) {
105 employer_->set_mainloop_thread(thread);
119 if ((mainloop_thread =
dynamic_cast<MainLoopAspect *
>(thread)) != NULL) {
121 mainloop_uc_.remove(mainloop_thread);
Aspect initializer/finalizer base class.
Thread cannot be finalized.
Thread cannot be initialized.
Base class for exceptions in Fawkes.
void append(const char *format,...) noexcept
Append messages to the message list.
virtual bool thread_init_failed(Thread *thread) noexcept
Thread initialization failed.
MainLoopAspectIniFin(MainLoopEmployer *employer, BlockedTimingExecutor *btexec)
Constructor.
virtual bool thread_started(Thread *thread) noexcept
Thread started successfully.
virtual void init(Thread *thread)
Initialize thread.
virtual void finalize(Thread *thread)
Finalize thread.
Thread aspect that allows to replace the main loop of the main application of Fawkes.
void init_MainLoopAspect(BlockedTimingExecutor *btexec)
Initialize main loop aspect.
Main loop employer The MainLoopEmployer calls the main loop for execution.
virtual void set_mainloop_thread(Thread *mainloop_thread)=0
Set a new main loop.
Thread class encapsulation of pthreads.
const char * name() const
Get name of thread.
OpMode opmode() const
Get operation mode.
void add_notification_listener(ThreadNotificationListener *notification_listener)
Add notification listener.
@ OPMODE_WAITFORWAKEUP
operate in wait-for-wakeup mode
Fawkes library namespace.