Index: src/hu/varadiistvan/scpl/_win32/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.copyright	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/.copyright	(revision 1)
@@ -0,0 +1,23 @@
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
Index: src/hu/varadiistvan/scpl/_win32/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.copyright	(revision 1)
+++ 	(revision )
@@ -1,23 +1,0 @@
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
Index: src/hu/varadiistvan/scpl/_win32/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.namespace	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/.namespace	(revision 1)
@@ -0,0 +1,3 @@
+hu
+varadiistvan
+scpl
Index: src/hu/varadiistvan/scpl/_win32/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.namespace	(revision 1)
+++ 	(revision )
@@ -1,3 +1,0 @@
-hu
-varadiistvan
-scpl
Index: src/hu/varadiistvan/scpl/_win32/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.srcmessage	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/.srcmessage	(revision 1)
@@ -0,0 +1,1 @@
+// This file is part of VSCPL, a simple cross-platform utility library
Index: src/hu/varadiistvan/scpl/_win32/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/_win32/.srcmessage	(revision 1)
+++ 	(revision )
@@ -1,1 +1,0 @@
-// This file is part of VSCPL, a simple cross-platform utility library
Index: src/hu/varadiistvan/scpl/_win32/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Makefile.am	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/Makefile.am	(revision 1)
@@ -0,0 +1,8 @@
+noinst_LTLIBRARIES=libvscpl_win32.la
+
+libvscpl_win32_la_SOURCES =	\
+	Thread.cc
+
+include_win32_posixdir=$(includedir)/hu/varadiistvan/scpl/_win32
+include_win32_posix_HEADERS=\
+	Thread.h
Index: src/hu/varadiistvan/scpl/_win32/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Makefile.am	(revision 1)
+++ 	(revision )
@@ -1,8 +1,0 @@
-noinst_LTLIBRARIES=libvscpl_win32.la
-
-libvscpl_win32_la_SOURCES =	\
-	Thread.cc
-
-include_win32_posixdir=$(includedir)/hu/varadiistvan/scpl/_win32
-include_win32_posix_HEADERS=\
-	Thread.h
Index: src/hu/varadiistvan/scpl/_win32/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Mutex.h	(revision 4)
+++ src/hu/varadiistvan/scpl/_win32/Mutex.h	(revision 4)
@@ -0,0 +1,132 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef HU_VARADIISTVAN_SCPL_MUTEX_H
+#define HU_VARADIISTVAN_SCPL_MUTEX_H
+//------------------------------------------------------------------------------
+
+#include <windows.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Mutual exclusion device implementation for Windows.
+ */
+class Mutex
+{
+private:
+    /**
+     * The handle of the mutex.
+     */
+    CRITICAL_SECTION mutex;
+
+public:
+    /**
+     * Construct the mutex.
+     */
+    Mutex();
+
+    /**
+     * Destroy the mutex.
+     */
+    ~Mutex();
+
+    /**
+     * Lock the mutex. If the mutex is locked by another thread, the
+     * caller one waits until the other thread releases the mutex.
+     */
+    void lock();
+
+    /**
+     * Try to lock the mutex. If the mutex is locked by another
+     * thread, this function returns false immediately. Otherwise it
+     * locks the mutex and returns true.
+     */
+    bool tryLock();
+
+    /**
+     * Unlock the mutex.
+     */
+    void unlock();
+
+    friend class CondVar;
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Mutex::Mutex()
+{
+    InitializeCriticalSection(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline Mutex::~Mutex()
+{
+    DeleteCriticalSection(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline void Mutex::lock()
+{
+    EnterCriticalSection(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline bool Mutex::tryLock()
+{
+    return TryEnterCriticalSection(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline void Mutex::unlock()
+{
+    LeaveCriticalSection(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_MUTEX_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_win32/Thread.cc
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Thread.cc	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/Thread.cc	(revision 1)
@@ -0,0 +1,56 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "Thread.h"
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::scpl::Thread;
+
+//------------------------------------------------------------------------------
+
+DWORD Thread::threadFn(LPVOID arg)
+{
+    Thread* thread = reinterpret_cast<Thread*>(arg);
+
+    thread->run();
+
+    if (thread->detached) delete thread;
+
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_win32/Thread.cc
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Thread.cc	(revision 1)
+++ 	(revision )
@@ -1,56 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of VSCPL, a simple cross-platform utility library
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-//------------------------------------------------------------------------------
-
-#include "Thread.h"
-
-//------------------------------------------------------------------------------
-
-using hu::varadiistvan::scpl::Thread;
-
-//------------------------------------------------------------------------------
-
-DWORD Thread::threadFn(LPVOID arg)
-{
-    Thread* thread = reinterpret_cast<Thread*>(arg);
-
-    thread->run();
-
-    if (thread->detached) delete thread;
-
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/scpl/_win32/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Thread.h	(revision 1)
+++ src/hu/varadiistvan/scpl/_win32/Thread.h	(revision 1)
@@ -0,0 +1,156 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
+#define HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
+//------------------------------------------------------------------------------
+
+#include <windows.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A Win32 API thread implementation.
+ */
+class Thread
+{
+public:
+    /**
+     * Sleep for the given number of milliseconds.
+     */
+    static void sleep(unsigned millis);
+
+private:
+    /**
+     * The thread-runner function.
+     */
+    static DWORD WINAPI threadFn(LPVOID arg);
+
+    /**
+     * Indicate if the thread is detached.
+     */
+    bool detached;
+
+    /**
+     * The thread handle.
+     */
+    HANDLE handle;
+
+public:
+    /**
+     * Construct the thread object.
+     */
+    Thread(bool detached = false);
+
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Thread();
+
+    /**
+     * Start the thread.
+     *
+     * @return if the thread could be started
+     */
+    bool start();
+
+    /**
+     * Perform the thread's real operation.
+     */
+    virtual void run() = 0;
+
+    /**
+     * Wait for the thread to quit.
+     */
+    void join();
+
+    void release();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline void Thread::sleep(unsigned millis)
+{
+    Sleep(millis);
+}
+
+//------------------------------------------------------------------------------
+
+inline Thread::Thread(bool detached) :
+    detached(detached),
+    handle(0)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline Thread::~Thread()
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool Thread::start()
+{
+    handle = CreateThread(0, 0, &threadFn, this, 0, 0);
+    bool isOK = handle!=0;
+    if (detached && handle!=0) {
+        CloseHandle(handle);
+        handle = 0;
+    }
+    return isOK;
+}
+
+//------------------------------------------------------------------------------
+
+inline void Thread::join()
+{
+    if (handle!=0) {
+        WaitForSingleObject(handle, INFINITE);
+        CloseHandle(handle);
+    }
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_win32/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Thread.h	(revision 1)
+++ 	(revision )
@@ -1,156 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of VSCPL, a simple cross-platform utility library
-
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-
-// 1. Redistributions of source code must retain the above copyright notice, this
-//    list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice,
-//    this list of conditions and the following disclaimer in the documentation
-//    and/or other materials provided with the distribution.
-
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// The views and conclusions contained in the software and documentation are those
-// of the authors and should not be interpreted as representing official policies,
-// either expressed or implied, of the FreeBSD Project.
-
-#ifndef HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
-#define HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
-//------------------------------------------------------------------------------
-
-#include <windows.h>
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-/**
- * A Win32 API thread implementation.
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-private:
-    /**
-     * The thread-runner function.
-     */
-    static DWORD WINAPI threadFn(LPVOID arg);
-
-    /**
-     * Indicate if the thread is detached.
-     */
-    bool detached;
-
-    /**
-     * The thread handle.
-     */
-    HANDLE handle;
-
-public:
-    /**
-     * Construct the thread object.
-     */
-    Thread(bool detached = false);
-
-    /**
-     * Virtual destructor.
-     */
-    virtual ~Thread();
-
-    /**
-     * Start the thread.
-     *
-     * @return if the thread could be started
-     */
-    bool start();
-
-    /**
-     * Perform the thread's real operation.
-     */
-    virtual void run() = 0;
-
-    /**
-     * Wait for the thread to quit.
-     */
-    void join();
-
-    void release();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void Thread::sleep(unsigned millis)
-{
-    Sleep(millis);
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::Thread(bool detached) :
-    detached(detached),
-    handle(0)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::~Thread()
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Thread::start()
-{
-    handle = CreateThread(0, 0, &threadFn, this, 0, 0);
-    bool isOK = handle!=0;
-    if (detached && handle!=0) {
-        CloseHandle(handle);
-        handle = 0;
-    }
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Thread::join()
-{
-    if (handle!=0) {
-        WaitForSingleObject(handle, INFINITE);
-        CloseHandle(handle);
-    }
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_SCPL_WIN32_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
