diff --git a/smocore/marionette/lifetime.cpp b/smocore/marionette/lifetime.cpp index 87b4460..7c36708 100644 --- a/smocore/marionette/lifetime.cpp +++ b/smocore/marionette/lifetime.cpp @@ -76,6 +76,19 @@ public: + ": Must be executed on Marionette thread"); } + /** FIXME: + * It may be necessary to add a delay here to ensure that all in-flight + * timer timeouts have finished executing? Or some other mechanism. + * + * We need some way to ensure that in-flight timeouts don't get fired + * during the finalize sequence. This is because they may depend on + * state that is being finalized or has been finalized at the point + * when they timeout. + * + * This seems to be actually happening with the delayed calls to + * AttachDeviceReq::attachDeviceReq2() inside of livoxGen1.cpp. + */ + device::DeviceManager::getInstance().finalizeDeviceReattacher(); smo::mind::globalMind->finalizeReq({context, std::bind( diff --git a/todo b/todo index 75d508f..95e8fdd 100644 --- a/todo +++ b/todo @@ -25,3 +25,7 @@ after they expire just in case boost doesn't clean up the internal callable that we passed it. Or else we'll have circular sh_ptr references in our continuations. +* Think of a unified mechanism or a design pattern which will ensure that + timeouts will always either expire or be canceled before program + finalization. + Or more generically, before their lifetime ends.