ASSERT(instance != started_modules_.end());
// Clear the handler before stopping the module to allow it to shut down gracefully.
+ LOG_INFO("Stopping Handler of Module %s", instance->second->ToString().c_str());
instance->second->handler_->Clear();
instance->second->handler_->WaitUntilStopped(kModuleStopTimeout);
+ LOG_INFO("Stopping Module %s", instance->second->ToString().c_str());
instance->second->Stop();
}
for (auto it = start_order_.rbegin(); it != start_order_.rend(); it++) {
#include "gtest/gtest.h"
+#include <functional>
+#include <future>
+
using ::bluetooth::os::Thread;
namespace bluetooth {
EXPECT_FALSE(registry_->IsStarted<TestModuleTwoDependencies>());
}
-void post_two_module_one_handler() {
+void post_to_module_one_handler() {
std::this_thread::sleep_for(std::chrono::milliseconds(100));
test_module_one_dependency_handler->Post(common::BindOnce([] { FAIL(); }));
}
ModuleList list;
list.add<TestModuleOneDependency>();
registry_->Start(&list, thread_);
- test_module_no_dependency_handler->Post(common::BindOnce(&post_two_module_one_handler));
+ test_module_no_dependency_handler->Post(common::BindOnce(&post_to_module_one_handler));
registry_->StopAll();
}
return true;
}
auto stop_status = executing_reactable_finished_->wait_for(timeout);
+ if (stop_status != std::future_status::ready) {
+ LOG_ERROR("Unregister reactable timed out");
+ }
return stop_status == std::future_status::ready;
}
auto future = promise.get_future();
handler_->Post(common::BindOnce(&StackManager::handle_shut_down, common::Unretained(this), std::move(promise)));
- auto stop_status = future.wait_for(std::chrono::seconds(3));
+ auto stop_status = future.wait_for(std::chrono::seconds(5));
ASSERT_LOG(stop_status == std::future_status::ready, "Can't stop stack");
handler_->Clear();
- handler_->WaitUntilStopped(std::chrono::milliseconds(20));
+ handler_->WaitUntilStopped(std::chrono::milliseconds(2000));
delete handler_;
delete management_thread_;
}