]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/thread.cpp
Add a missing #include <windows.h>
[libs/core.git] / source / core / thread.cpp
index c7981cc4bcff9e24110d241768bf8e790d1c18a8..810b1f80485197eeb66552707897c89e42356215 100644 (file)
@@ -1,8 +1,10 @@
-/*
+/* $Id$
+
 This file is part of libmspcore
 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
+
 #ifndef WIN32
 #include <signal.h>
 #endif
@@ -24,7 +26,7 @@ void Thread::join()
 #else
        pthread_join(thread_, 0);
 #endif
-       launched_=false;
+       launched_ = false;
 }
 
 /**
@@ -52,7 +54,10 @@ void Thread::kill()
 Thread::~Thread()
 {
        if(launched_)
+       {
                kill();
+               join();
+       }
 }
 
 void Thread::launch()
@@ -62,11 +67,11 @@ void Thread::launch()
 
 #ifdef WIN32
        DWORD dummy;  // Win9x needs the lpTthreadId parameter
-       thread_=CreateThread(0, 0, &main_, this, 0, &dummy);
+       thread_ = CreateThread(0, 0, &main_, this, 0, &dummy);
 #else
        pthread_create(&thread_, 0, &main_, this);
 #endif
-       launched_=true;
+       launched_ = true;
 }
 
 } // namespace Msp