Exemplo n.º 1
0
// Detects resources
void Installer::detectResources()
{
    ModuleList modules =
        m_factory->getModuleFactory()->getModules();

    try
    {
        m_factory->getResources()->initDevs();
        IModuleFactory *modfactory = m_factory->getModuleFactory();

        for (ModuleList::iterator mod = modules.begin();
             mod != modules.end(); mod++)
        {
            IResourcesPtr res = modfactory->getResources((*mod)->getID());
            if (res)
            {
                res->initDevs();
                res->updateDB(res->getType());
            }
        }
    }
    catch(const std::exception& err)
    {
        klk_log(KLKLOG_ERROR, "Installer error: %s", err.what());
        throw;
    }
}
Exemplo n.º 2
0
// Starts module thread
void ModuleFactory::startModuleThread(const IModulePtr& module)
{
    BOOST_ASSERT(module);

    Locker lock(&m_lock);

    IThreadPtr thread =
        boost::dynamic_pointer_cast<IThread, IModule>(module);
    BOOST_ASSERT(thread);
    if (getScheduler()->isStarted(thread) == false)
    {
        // before load the module we have to init it's devices
        IResourcesPtr resources = getResources(module->getID());
        if (resources)
        {
            resources->initDevs();
            m_factory->getResources()->add(resources);
        }
        getScheduler()->startThread(thread);
    }
    BOOST_ASSERT(getScheduler()->isStarted(thread) == true);
}