bool ModuleManager::Unload(Module* mod) { if (!CanUnload(mod)) return false; ServerInstance->AtomicActions.AddAction(new UnloadAction(mod)); return true; }
void ModuleManager::Reload(Module* mod, HandlerBase1<void, bool>* callback) { if (CanUnload(mod)) ServerInstance->AtomicActions.AddAction(new ReloadAction(mod, callback)); else callback->Call(false); }
void ModuleManager::UnloadAll() { /* We do this more than once, so that any service providers get a * chance to be unhooked by the modules using them, but then get * a chance to be removed themsleves. * * Note: this deliberately does NOT delete the DLLManager objects */ for (int tries = 0; tries < 4; tries++) { std::map<std::string, Module*>::iterator i = Modules.begin(); while (i != Modules.end()) { std::map<std::string, Module*>::iterator me = i++; if (CanUnload(me->second)) { DoSafeUnload(me->second); } } ServerInstance->GlobalCulls.Apply(); } }
/// \brief /// Ensures that the resource is unloaded inline void EnsureUnloaded() { if (!IsLoaded()) return; VASSERT(CanUnload()); ///< this should be tested outside this function! DoUnload(); }