summaryrefslogtreecommitdiff
path: root/src/modmanager_static.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-19 02:28:30 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-01-19 02:28:30 +0000
commit0429d86a7afa7d5c1e27e48f27db0687d2688d87 (patch)
treeb25b6bfbc41f67156a7a5b4d9b4cca34e3a9f26d /src/modmanager_static.cpp
parent066cad22e48e111de9a993c9ebaddb275b773a75 (diff)
Clean up some slow iterations
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12300 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modmanager_static.cpp')
-rw-r--r--src/modmanager_static.cpp26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp
index e267a2c90..d9ee07a25 100644
--- a/src/modmanager_static.cpp
+++ b/src/modmanager_static.cpp
@@ -85,12 +85,19 @@ bool ModuleManager::Load(const char* name)
return false;
}
-bool ModuleManager::Unload(Module* mod)
-{
- return false;
-}
-
namespace {
+ struct UnloadAction : public HandlerBase0<void>
+ {
+ Module* const mod;
+ UnloadAction(Module* m) : mod(m) {}
+ void Call()
+ {
+ ServerInstance->Modules->DoSafeUnload(mod);
+ ServerInstance->GlobalCulls.Apply();
+ ServerInstance->GlobalCulls.AddItem(this);
+ }
+ };
+
struct ReloadAction : public HandlerBase0<void>
{
Module* const mod;
@@ -109,6 +116,14 @@ namespace {
};
}
+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))
@@ -127,6 +142,7 @@ void ModuleManager::LoadAll()
{
c = (*(**i).init)();
c->ModuleSourceFile = (**i).name;
+ c->ModuleDLLManager = NULL;
Modules[(**i).name] = c;
c->init();
FOREACH_MOD(I_OnLoadModule,OnLoadModule(c));