summaryrefslogtreecommitdiff
path: root/include/inspircd.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-10 22:17:51 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-10 22:17:51 +0000
commit540fee57bf71abccaba38c0297b80f8001780c1d (patch)
tree0a02c41f92100925e5f6a3db709372322389517e /include/inspircd.h
parent5c0c0ec057e1f1bc9dd837c1654927b5b534e5c0 (diff)
Add InspIRCd::UseInterface and InspIRCd::DoneWithInterface, and also InspIRCd::GetInterfaceUseCount().
These can be used for one module to lock other modules in memory that it depends on, this way they can enforce an unload order so that you cant (for example) unload m_ssl_gnutls.so whilst m_spanningtree.so is using it for ssl server to server sessions (in this case, youd have to unload spanningtree first, THEN ssl_gnutls, to satisfy the dependencies and unload orders) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5924 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/inspircd.h')
-rw-r--r--include/inspircd.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index 74678b206..8cce5513a 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -727,6 +727,31 @@ class InspIRCd : public classbase
*/
bool PublishInterface(const std::string &InterfaceName, Module* Mod);
+ /** Return a pair saying how many other modules are currently using the
+ * interfaces provided by module m.
+ * @param m The module to count usage for
+ * @return A pair, where the first value is the number of uses of the interface,
+ * and the second value is the interface name being used.
+ */
+ std::pair<int,std::string> GetInterfaceInstanceCount(Module* m);
+
+ /** Mark your module as using an interface.
+ * If you mark your module as using an interface, then that interface
+ * module may not unload until your module has unloaded first.
+ * This can be used to prevent crashes by ensuring code you depend on
+ * is always in memory while your module is active.
+ * @param InterfaceName The interface to use
+ */
+ void UseInterface(const std::string &InterfaceName);
+
+ /** Mark your module as finished with an interface.
+ * If you used UseInterface() above, you should use this method when
+ * your module is finished with the interface (usually in its destructor)
+ * to allow the modules which implement the given interface to be unloaded.
+ * @param InterfaceName The interface you are finished with using.
+ */
+ void DoneWithInterface(const std::string &InterfaceName);
+
/** Unpublish a 'feature'.
* When your module exits, it must call this method for every feature it
* is providing so that the feature table is cleaned up.