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>
42 BlockedTimingExecutor *btexec)
43 : AspectIniFin(
"MainLoopAspect")
54 if (mainloop_thread == NULL) {
56 "MainLoopAspect, but RTTI says it "
63 "in wait-for-wakeup mode.");
67 mainloop_uc_.add(mainloop_thread);
68 mainloop_thread->init_MainLoopAspect(btexec_);
69 thread->add_notification_listener(
this);
70 }
catch (Exception &e) {
71 CannotInitializeThreadException ce(
"Main loop thread failed to initialize");
80 MainLoopAspect *mainloop_thread;
81 mainloop_thread =
dynamic_cast<MainLoopAspect *
>(thread);
82 if (mainloop_thread == NULL) {
83 throw CannotInitializeThreadException(
"Thread '%s' claims to have the "
84 "MainLoopAspect, but RTTI says it "
91 mainloop_uc_.remove(mainloop_thread);
92 }
catch (Exception &e) {
93 CannotFinalizeThreadException ce(
"Failed to remove time source");
102 MainLoopAspect *mainloop_thread;
103 if ((mainloop_thread =
dynamic_cast<MainLoopAspect *
>(thread)) != NULL) {
105 employer_->set_mainloop_thread(thread);
118 MainLoopAspect *mainloop_thread;
119 if ((mainloop_thread =
dynamic_cast<MainLoopAspect *
>(thread)) != NULL) {
121 mainloop_uc_.remove(mainloop_thread);
131 }
catch (Exception &e) {