diff options
author | Adam <Adam@anope.org> | 2011-02-17 14:31:21 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-02-17 14:31:21 -0500 |
commit | 536ea2189ae1ff8bf05583ed03fac86797616ac9 (patch) | |
tree | 30b5056f53dea0d01be10f24360a443833e6565a /modules/extra/async_commands.h | |
parent | 18bd33f9a477f7ce00d6f3c00acc0b0b68f5028d (diff) |
Split db_mysql_live into two modules so other modules can make use of the asynchronous command interface
Diffstat (limited to 'modules/extra/async_commands.h')
-rw-r--r-- | modules/extra/async_commands.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules/extra/async_commands.h b/modules/extra/async_commands.h new file mode 100644 index 000000000..b6b9e7c2b --- /dev/null +++ b/modules/extra/async_commands.h @@ -0,0 +1,30 @@ + +class CommandMutex : public Thread +{ + public: + // Mutex used by this command to allow the core to drop and pick up processing of it at will + Mutex mutex; + // Set to true when this thread is processing data that is not thread safe (eg, the command) + bool processing; + Command *command; + CommandSource source; + std::vector<Anope::string> params; + + CommandMutex() : Thread(), processing(true) { } + + ~CommandMutex() { } + + virtual void Run() = 0; + + virtual void Lock() = 0; + + virtual void Unlock() = 0; +}; + +class AsynchCommandsService : public Service +{ + public: + AsynchCommandsService(Module *o, const Anope::string &n) : Service(o, n) { } + virtual CommandMutex *CurrentCommand() = 0; +}; + |