diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-10 14:50:38 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-10 14:50:38 +0000 |
commit | 11c08b9aed1792705e5d82b343fae6ce56910338 (patch) | |
tree | 31a3cb573ac3958dd9702dedce9d399da111e424 /include/threadengine.h | |
parent | eedce11c9606f24d339d8055fd9d0f995b4e0951 (diff) |
Each Thread class must have its own thread handle, duh. Someone take away my craqpipe NOW.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8876 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/threadengine.h')
-rw-r--r-- | include/threadengine.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/threadengine.h b/include/threadengine.h index 7d27b867a..0f729a962 100644 --- a/include/threadengine.h +++ b/include/threadengine.h @@ -21,14 +21,8 @@ #include "base.h" class InspIRCd; +class Thread; -class CoreExport Thread : public Extensible -{ - public: - Thread() { }; - virtual ~Thread() { }; - virtual void Run() = 0; -}; class CoreExport ThreadEngine : public Extensible { @@ -48,6 +42,30 @@ class CoreExport ThreadEngine : public Extensible virtual void Run() = 0; virtual void Create(Thread* thread_to_init) = 0; + + virtual void FreeThread(Thread* thread) = 0; }; +class CoreExport Thread : public Extensible +{ + public: + + ThreadEngine* Creator; + + Thread() : Creator(NULL) + { + } + + virtual ~Thread() + { + if (Creator) + Creator->FreeThread(this); + } + + virtual void Run() = 0; +}; + + + #endif + |