summaryrefslogtreecommitdiff
path: root/include/threadengine.h
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-10 19:55:07 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-08-10 19:55:07 +0000
commit8235290c734c17f5b52533876136e9a61d231c9d (patch)
tree82acae114b8e64b7b53b17b257f292f8e6b0686d /include/threadengine.h
parent5c4212ee9be88b05f39fc5a0fb0a8fa6366e048b (diff)
Fix thread join not working for subclasses of Thread because of C++ destructor ordering
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11500 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/threadengine.h')
-rw-r--r--include/threadengine.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/threadengine.h b/include/threadengine.h
index c11f2d817..10f3fed13 100644
--- a/include/threadengine.h
+++ b/include/threadengine.h
@@ -30,7 +30,7 @@ class ThreadData;
* code. Be sure to keep your code thread-safe and not prone to deadlocks
* and race conditions if you MUST use threading!
*/
-class CoreExport Thread : public Extensible
+class CoreExport Thread
{
private:
/** Set to true when the thread is to exit
@@ -55,6 +55,7 @@ class CoreExport Thread : public Extensible
{
}
+ /* If the thread is running, you MUST join BEFORE deletion */
virtual ~Thread();
/** Override this method to put your actual
@@ -64,10 +65,11 @@ class CoreExport Thread : public Extensible
/** Signal the thread to exit gracefully.
*/
- virtual void SetExitFlag()
- {
- ExitFlag = true;
- }
+ virtual void SetExitFlag();
+
+ /** Join the thread (calls SetExitFlag and waits for exit)
+ */
+ void join();
};