summaryrefslogtreecommitdiffstats
path: root/src/Bindings/PluginManager.h
diff options
context:
space:
mode:
author[IPSA] Chris de Claverie <c.de-claverie@protonmail.com>2020-09-28 00:15:03 +0200
committerGitHub <noreply@github.com>2020-09-28 00:15:03 +0200
commit9a548b3b3e5d69bc776383860a0611babd654d7b (patch)
tree86d43bfe622550e2af1120f5613b0c0415bfded6 /src/Bindings/PluginManager.h
parentFixing Mob spawner behaviour (#4930) (diff)
downloadcuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar.gz
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar.bz2
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar.lz
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar.xz
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.tar.zst
cuberite-9a548b3b3e5d69bc776383860a0611babd654d7b.zip
Diffstat (limited to 'src/Bindings/PluginManager.h')
-rw-r--r--src/Bindings/PluginManager.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/Bindings/PluginManager.h b/src/Bindings/PluginManager.h
index 353950f18..8d75509a1 100644
--- a/src/Bindings/PluginManager.h
+++ b/src/Bindings/PluginManager.h
@@ -162,6 +162,14 @@ public:
} ; // tolua_export
+ /** Defines the deferred actions needed for a plugin */
+ enum class PluginAction
+ {
+ Reload,
+ Unload
+ };
+
+
/** Used as a callback for enumerating bound commands */
class cCommandEnumCallback
{
@@ -303,6 +311,10 @@ public:
Note that this function returns before the plugin is unloaded, to avoid deadlocks. */
void UnloadPlugin(const AString & a_PluginFolder); // tolua_export
+ /** Queues the specified plugin to be reloaded in the next call to Tick().
+ Note that this function returns before the plugin is unloaded, to avoid deadlocks. */
+ void ReloadPlugin(const AString & a_PluginFolder); // tolua_export
+
/** Loads the plugin from the specified plugin folder.
Returns true if the plugin was loaded successfully or was already loaded before, false otherwise. */
bool LoadPlugin(const AString & a_PluginFolder); // tolua_export
@@ -408,13 +420,13 @@ private:
typedef std::map<AString, cCommandReg> CommandMap;
- /** FolderNames of plugins that should be unloaded.
- The plugins will be unloaded within the next call to Tick(), to avoid multithreading issues.
- Protected against multithreaded access by m_CSPluginsToUnload. */
- AStringVector m_PluginsToUnload;
+ /** FolderNames of plugins that need an action (unload, reload, ...).
+ The plugins will be acted upon within the next call to Tick(), to avoid multithreading issues.
+ Protected against multithreaded access by m_CSPluginsNeedAction. */
+ std::vector<std::pair<PluginAction, AString>> m_PluginsNeedAction;
/** Protects m_PluginsToUnload against multithreaded access. */
- mutable cCriticalSection m_CSPluginsToUnload;
+ mutable cCriticalSection m_CSPluginsNeedAction;
/** All plugins that have been found in the Plugins folder. */
cPluginPtrs m_Plugins;