]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/jthread/jthread.h
Fix broken async locking in release build
[dragonfireclient.git] / src / jthread / jthread.h
index ec1eafaeb23dee7ea0a60c322f640c7aef4b572e..f7bce6f9a42400fdf8bc858f8798a7255814abce 100644 (file)
@@ -43,11 +43,20 @@ class JThread
        JThread();
        virtual ~JThread();
        int Start();
+       void Stop();
        int Kill();
        virtual void *Thread() = 0;
        bool IsRunning();
+       bool StopRequested();
        void *GetReturnValue();
        bool IsSameThread();
+
+       /*
+        * Wait for thread to finish
+        * Note: this does not stop a thread you have to do this on your own
+        * WARNING: never ever call this on a thread not started or already killed!
+        */
+       void Wait();
 protected:
        void ThreadStarted();
 private:
@@ -63,15 +72,17 @@ class JThread
        HANDLE threadhandle;
 #else // pthread type threads
        static void *TheThread(void *param);
-       
+
        pthread_t threadid;
+
+       bool started;
 #endif // WIN32
        void *retval;
        bool running;
-       
+       bool requeststop;
+
        JMutex runningmutex;
        JMutex continuemutex,continuemutex2;
-       bool mutexinit;
 };
 
 #endif // JTHREAD_H