Index: src/hu/varadiistvan/Makefile.am
===================================================================
--- src/hu/varadiistvan/Makefile.am	(revision 0)
+++ src/hu/varadiistvan/Makefile.am	(revision 0)
@@ -0,0 +1,1 @@
+SUBDIRS=scpl
Index: src/hu/varadiistvan/Makefile.am
===================================================================
--- src/hu/varadiistvan/Makefile.am	(revision 0)
+++ 	(revision )
@@ -1,1 +1,0 @@
-SUBDIRS=scpl
Index: src/hu/varadiistvan/scpl/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/.copyright	(revision 1)
+++ src/hu/varadiistvan/scpl/.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/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/.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/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/.namespace	(revision 1)
+++ src/hu/varadiistvan/scpl/.namespace	(revision 1)
@@ -0,0 +1,3 @@
+hu
+varadiistvan
+scpl
Index: src/hu/varadiistvan/scpl/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/.namespace	(revision 1)
+++ 	(revision )
@@ -1,3 +1,0 @@
-hu
-varadiistvan
-scpl
Index: src/hu/varadiistvan/scpl/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/.srcmessage	(revision 1)
+++ src/hu/varadiistvan/scpl/.srcmessage	(revision 1)
@@ -0,0 +1,1 @@
+// This file is part of VSCPL, a simple cross-platform utility library
Index: src/hu/varadiistvan/scpl/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/.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/CondVar.h
===================================================================
--- src/hu/varadiistvan/scpl/CondVar.h	(revision 5)
+++ src/hu/varadiistvan/scpl/CondVar.h	(revision 5)
@@ -0,0 +1,113 @@
+// 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_CONDVAR_H
+#define HU_VARADIISTVAN_SCPL__CONDVAR_H
+//------------------------------------------------------------------------------
+
+#if 0 // The public interface of CondVar
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+class Mutex;
+
+//------------------------------------------------------------------------------
+
+/**
+ * Condition variable.
+ */
+class CondVar
+{
+public:
+    /**
+     * Wait for the condition variable.
+     *
+     * @param mutex the mutex to unlock and re-lock.
+     * @param timeout the number of milliseconds to wait at most. If
+     * negative, the function will wait indefinitely.
+     *
+     * @return true, if the condition variable was signalled, false
+     * if a timeout occured
+     */
+    bool wait(Mutex& mutex, int timeout = -1);
+
+    /**
+     * Signal the condition variable to wake up one thread.
+     */
+    void signal();
+
+    /**
+     * Signal all threads waiting on the condition variable.
+     */
+    void broadcast();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+
+#endif // 0, The public interface of CondVar
+
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+//------------------------------------------------------------------------------
+
+#if TARGET_API_POSIX
+
+#include "_posix/CondVar.h"
+
+//------------------------------------------------------------------------------
+
+#elif TARGET_API_WIN32 || TARGET_API_WIN64
+
+#include "_win32/CondVar.h"
+
+//------------------------------------------------------------------------------
+
+#else
+
+#error "Not implemented for this target!"
+
+#endif
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_CONDVAR_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/Makefile.am	(revision 5)
+++ src/hu/varadiistvan/scpl/Makefile.am	(revision 5)
@@ -0,0 +1,30 @@
+SUBDIRS=
+
+if TARGET_API_POSIX
+SUBDIRS+=_posix
+endif
+
+if TARGET_API_WIN32
+SUBDIRS+=_win32
+AM_LDFLAGS=-no-undefined
+endif
+
+lib_LTLIBRARIES=libvscpl.la
+
+libvscpl_la_SOURCES=\
+        dummy.cc
+
+if TARGET_API_POSIX
+libvscpl_la_LIBADD=_posix/libvscpl_posix.la
+endif
+
+if TARGET_API_WIN32
+libvscpl_la_LIBADD=_win32/libvscpl_win32.la
+endif
+
+include_vscpldir=$(includedir)/hu/varadiistvan/scpl
+include_vscpl_HEADERS=\
+        config.h                \
+        Thread.h                \
+        Mutex.h                 \
+        CondVar.h
Index: src/hu/varadiistvan/scpl/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/Makefile.am	(revision 1)
+++ 	(revision )
@@ -1,28 +1,0 @@
-SUBDIRS=
-
-if TARGET_API_POSIX
-SUBDIRS+=_posix
-endif
-
-if TARGET_API_WIN32
-SUBDIRS+=_win32
-AM_LDFLAGS=-no-undefined
-endif
-
-lib_LTLIBRARIES=libvscpl.la
-
-libvscpl_la_SOURCES=\
-        dummy.cc
-
-if TARGET_API_POSIX
-libvscpl_la_LIBADD=_posix/libvscpl_posix.la
-endif
-
-if TARGET_API_WIN32
-libvscpl_la_LIBADD=_win32/libvscpl_win32.la
-endif
-
-include_vscpldir=$(includedir)/hu/varadiistvan/scpl
-include_vscpl_HEADERS=\
-        config.h                \
-        Thread.h
Index: src/hu/varadiistvan/scpl/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/Mutex.h	(revision 4)
+++ src/hu/varadiistvan/scpl/Mutex.h	(revision 4)
@@ -0,0 +1,105 @@
+// 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
+//------------------------------------------------------------------------------
+
+#if 0 // The public interface of Mutex
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A mutual exclusion device.
+ */
+class Mutex
+{
+public:
+    /**
+     * 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();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+
+#endif // 0, The public interface of Mutex
+
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+//------------------------------------------------------------------------------
+
+#if TARGET_API_POSIX
+
+#include "_posix/Mutex.h"
+
+//------------------------------------------------------------------------------
+
+#elif TARGET_API_WIN32 || TARGET_API_WIN64
+
+#include "_win32/Mutex.h"
+
+//------------------------------------------------------------------------------
+
+#else
+
+#error "Not implemented for this target!"
+
+#endif
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_MUTEX_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/Mutex.h	(revision 4)
+++ 	(revision )
@@ -1,105 +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_MUTEX_H
-#define HU_VARADIISTVAN_SCPL__MUTEX_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of Mutex
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-/**
- * A mutual exclusion device.
- */
-class Mutex
-{
-public:
-    /**
-     * 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();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of Mutex
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_POSIX
-
-#include "_posix/Mutex.h"
-
-//------------------------------------------------------------------------------
-
-#elif TARGET_API_WIN32 || TARGET_API_WIN64
-
-#include "_win32/Mutex.h"
-
-//------------------------------------------------------------------------------
-
-#else
-
-#error "Not implemented for this target!"
-
-#endif
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_SCPL_MUTEX_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/scpl/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/Thread.h	(revision 3)
+++ src/hu/varadiistvan/scpl/Thread.h	(revision 3)
@@ -0,0 +1,126 @@
+// 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_THREAD_H
+#define HU_VARADIISTVAN_SCPL_THREAD_H
+//------------------------------------------------------------------------------
+
+// The public interface of the Thread class common to all platforms
+#if 0
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A thread
+ */
+class Thread
+{
+public:
+    /**
+     * Sleep for the given number of milliseconds.
+     */
+    static void sleep(unsigned millis);
+
+public:
+    /**
+     * Construct the thread.
+     *
+     * @param detached if true, the thread will be created as a
+     * detached one, i.e. it can't be joined later on. The thread
+     * object will also be deleted when its run() function has
+     * finished.
+     */
+    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. To be implemented in children
+     */
+    virtual void run() = 0;
+
+    /**
+     * Wait for the thread to quit.
+     */
+    void join();
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+
+#endif // 0, The public interface of the Thread class common to all platforms
+
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+//------------------------------------------------------------------------------
+
+#if TARGET_API_POSIX
+
+#include "_posix/Thread.h"
+
+//------------------------------------------------------------------------------
+
+#elif TARGET_API_WIN32 || TARGET_API_WIN64
+
+#include "_win32/Thread.h"
+
+//------------------------------------------------------------------------------
+
+#else
+
+#error "Not implemented for this target!"
+
+#endif
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_THREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/Thread.h	(revision 3)
+++ 	(revision )
@@ -1,126 +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_THREAD_H
-#define HU_VARADIISTVAN_SCPL_THREAD_H
-//------------------------------------------------------------------------------
-
-// The public interface of the Thread class common to all platforms
-#if 0
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-/**
- * A thread
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-public:
-    /**
-     * Construct the thread.
-     *
-     * @param detached if true, the thread will be created as a
-     * detached one, i.e. it can't be joined later on. The thread
-     * object will also be deleted when its run() function has
-     * finished.
-     */
-    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. To be implemented in children
-     */
-    virtual void run() = 0;
-
-    /**
-     * Wait for the thread to quit.
-     */
-    void join();
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of the Thread class common to all platforms
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_POSIX
-
-#include "_posix/Thread.h"
-
-//------------------------------------------------------------------------------
-
-#elif TARGET_API_WIN32 || TARGET_API_WIN64
-
-#include "_win32/Thread.h"
-
-//------------------------------------------------------------------------------
-
-#else
-
-#error "Not implemented for this target!"
-
-#endif
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_SCPL_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/scpl/_posix/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.copyright	(revision 1)
+++ src/hu/varadiistvan/scpl/_posix/.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/_posix/.copyright
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.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/_posix/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.namespace	(revision 1)
+++ src/hu/varadiistvan/scpl/_posix/.namespace	(revision 1)
@@ -0,0 +1,3 @@
+hu
+varadiistvan
+scpl
Index: src/hu/varadiistvan/scpl/_posix/.namespace
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.namespace	(revision 1)
+++ 	(revision )
@@ -1,3 +1,0 @@
-hu
-varadiistvan
-scpl
Index: src/hu/varadiistvan/scpl/_posix/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.srcmessage	(revision 1)
+++ src/hu/varadiistvan/scpl/_posix/.srcmessage	(revision 1)
@@ -0,0 +1,1 @@
+// This file is part of VSCPL, a simple cross-platform utility library
Index: src/hu/varadiistvan/scpl/_posix/.srcmessage
===================================================================
--- src/hu/varadiistvan/scpl/_posix/.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/_posix/CondVar.cc
===================================================================
--- src/hu/varadiistvan/scpl/_posix/CondVar.cc	(revision 5)
+++ src/hu/varadiistvan/scpl/_posix/CondVar.cc	(revision 5)
@@ -0,0 +1,60 @@
+// 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 "CondVar.h"
+
+#include <sys/time.h>
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::scpl::CondVar;
+
+//------------------------------------------------------------------------------
+
+void CondVar::getAbsTime(struct ::timespec& abstime, int timeout)
+{
+    struct timeval tv;
+    gettimeofday(&tv, 0);
+
+    abstime.tv_sec = tv.tv_sec + timeout / 1000;
+    abstime.tv_nsec = (tv.tv_usec + (timeout%1000) * 1000) * 1000;
+    if (abstime.tv_nsec>=1000000000) {
+        ++abstime.tv_sec;
+        abstime.tv_nsec -= 1000000000;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_posix/CondVar.h
===================================================================
--- src/hu/varadiistvan/scpl/_posix/CondVar.h	(revision 5)
+++ src/hu/varadiistvan/scpl/_posix/CondVar.h	(revision 5)
@@ -0,0 +1,147 @@
+// 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_CONDVAR_H
+#define HU_VARADIISTVAN_SCPL_CONDVAR_H
+//------------------------------------------------------------------------------
+
+#include "Mutex.h"
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A condition variable for POSIX threads.
+ */
+class CondVar
+{
+private:
+    /**
+     * Fill the given timespec with the absolute time corresponding to
+     * the given relative timeout.
+     */
+    static void getAbsTime(struct ::timespec& abstime, int timeout);
+
+    /**
+     * The pthreads structure.
+     */
+    pthread_cond_t cond;
+
+public:
+    /**
+     * Construct the condition variable.
+     */
+    CondVar();
+
+    /**
+     * Destroy the condition variable.
+     */
+    ~CondVar();
+
+    /**
+     * Wait for the condition variable.
+     *
+     * @param mutex the mutex to unlock and re-lock.
+     * @param timeout the number of milliseconds to wait at most. If
+     * negative, the function will wait indefinitely.
+     *
+     * @return true, if the condition variable was signalled, false
+     * if a timeout occured
+     */
+    bool wait(Mutex& mutex, int timeout = -1);
+
+    /**
+     * Signal the condition variable to wake up one thread.
+     */
+    void signal();
+
+    /**
+     * Signal all threads waiting on the condition variable.
+     */
+    void broadcast();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline CondVar::CondVar()
+{
+    pthread_cond_init(&cond, 0);
+}
+
+//------------------------------------------------------------------------------
+
+inline CondVar::~CondVar()
+{
+    pthread_cond_destroy(&cond);
+}
+
+//------------------------------------------------------------------------------
+
+inline bool CondVar::wait(Mutex& mutex, int timeout)
+{
+    if (timeout<0) {
+        pthread_cond_wait(&cond, &mutex.mutex);
+        return true;
+    } else {
+        struct ::timespec abstime;
+        getAbsTime(abstime, timeout);
+        return pthread_cond_timedwait(&cond, &mutex.mutex, &abstime)==0;
+    }
+}
+
+//------------------------------------------------------------------------------
+
+inline void CondVar::signal()
+{
+    pthread_cond_signal(&cond);
+}
+
+//------------------------------------------------------------------------------
+
+inline void CondVar::broadcast()
+{
+    pthread_cond_broadcast(&cond);
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_CONDVAR_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_posix/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Makefile.am	(revision 5)
+++ src/hu/varadiistvan/scpl/_posix/Makefile.am	(revision 5)
@@ -0,0 +1,11 @@
+noinst_LTLIBRARIES=libvscpl_posix.la
+
+libvscpl_posix_la_SOURCES =	\
+	Thread.cc		\
+	CondVar.cc
+
+include_vscpl_posixdir=$(includedir)/hu/varadiistvan/scpl/_posix
+include_vscpl_posix_HEADERS=\
+	Thread.h		\
+	Mutex.h			\
+	CondVar.h
Index: src/hu/varadiistvan/scpl/_posix/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Makefile.am	(revision 1)
+++ 	(revision )
@@ -1,8 +1,0 @@
-noinst_LTLIBRARIES=libvscpl_posix.la
-
-libvscpl_posix_la_SOURCES =	\
-	Thread.cc
-
-include_vscpl_posixdir=$(includedir)/hu/varadiistvan/scpl/_posix
-include_vscpl_posix_HEADERS=\
-	Thread.h
Index: src/hu/varadiistvan/scpl/_posix/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Mutex.h	(revision 4)
+++ src/hu/varadiistvan/scpl/_posix/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 <pthread.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Mutual exclusion device for POSIX threads.
+ */
+class Mutex
+{
+private:
+    /**
+     * The mutex structure.
+     */
+    pthread_mutex_t 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()
+{
+    pthread_mutex_init(&mutex, 0);
+}
+
+//------------------------------------------------------------------------------
+
+inline Mutex::~Mutex()
+{
+    pthread_mutex_destroy(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline void Mutex::lock()
+{
+    pthread_mutex_lock(&mutex);
+}
+
+//------------------------------------------------------------------------------
+
+inline bool Mutex::tryLock()
+{
+    return pthread_mutex_trylock(&mutex)==0;
+}
+
+//------------------------------------------------------------------------------
+
+inline void Mutex::unlock()
+{
+    pthread_mutex_unlock(&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/_posix/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Mutex.h	(revision 4)
+++ 	(revision )
@@ -1,132 +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_MUTEX_H
-#define HU_VARADIISTVAN_SCPL_MUTEX_H
-//------------------------------------------------------------------------------
-
-#include <pthread.h>
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-/**
- * Mutual exclusion device for POSIX threads.
- */
-class Mutex
-{
-private:
-    /**
-     * The mutex structure.
-     */
-    pthread_mutex_t 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()
-{
-    pthread_mutex_init(&mutex, 0);
-}
-
-//------------------------------------------------------------------------------
-
-inline Mutex::~Mutex()
-{
-    pthread_mutex_destroy(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::lock()
-{
-    pthread_mutex_lock(&mutex);
-}
-
-//------------------------------------------------------------------------------
-
-inline bool Mutex::tryLock()
-{
-    return pthread_mutex_trylock(&mutex)==0;
-}
-
-//------------------------------------------------------------------------------
-
-inline void Mutex::unlock()
-{
-    pthread_mutex_unlock(&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/_posix/Thread.cc
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Thread.cc	(revision 1)
+++ src/hu/varadiistvan/scpl/_posix/Thread.cc	(revision 1)
@@ -0,0 +1,66 @@
+// 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;
+
+//------------------------------------------------------------------------------
+
+void* Thread::threadFn(void* arg)
+{
+    Thread* thread = reinterpret_cast<Thread*>(arg);
+    thread->run();
+    if (thread->detached) delete thread;
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+
+bool Thread::start()
+{
+    pthread_attr_t attr;
+    pthread_attr_init(&attr);
+    pthread_attr_setdetachstate(&attr, detached ? PTHREAD_CREATE_DETACHED :
+                                PTHREAD_CREATE_JOINABLE);
+    bool isOK = pthread_create(&thread, &attr, &threadFn, this)>=0;
+    pthread_attr_destroy(&attr);
+    return isOK;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_posix/Thread.cc
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Thread.cc	(revision 1)
+++ 	(revision )
@@ -1,66 +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;
-
-//------------------------------------------------------------------------------
-
-void* Thread::threadFn(void* arg)
-{
-    Thread* thread = reinterpret_cast<Thread*>(arg);
-    thread->run();
-    if (thread->detached) delete thread;
-    return 0;
-}
-
-//------------------------------------------------------------------------------
-
-bool Thread::start()
-{
-    pthread_attr_t attr;
-    pthread_attr_init(&attr);
-    pthread_attr_setdetachstate(&attr, detached ? PTHREAD_CREATE_DETACHED :
-                                PTHREAD_CREATE_JOINABLE);
-    bool isOK = pthread_create(&thread, &attr, &threadFn, this)>=0;
-    pthread_attr_destroy(&attr);
-    return isOK;
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/scpl/_posix/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Thread.h	(revision 1)
+++ src/hu/varadiistvan/scpl/_posix/Thread.h	(revision 1)
@@ -0,0 +1,138 @@
+// 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_POSIX_THREAD_H
+#define HU_VARADIISTVAN_SCPL_POSIX_THREAD_H
+//------------------------------------------------------------------------------
+
+#include <pthread.h>
+#include <unistd.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A pthreads-based thread implementation.
+ */
+class Thread
+{
+public:
+    /**
+     * Sleep for the given number of milliseconds.
+     */
+    static void sleep(unsigned millis);
+
+private:
+    /**
+     * The thread-runner function.
+     */
+    static void* threadFn(void* arg);
+
+    /**
+     * Indicate if the thread is detached or not.
+     */
+    bool detached;
+
+    /**
+     * The posix thread handle.
+     */
+    pthread_t thread;
+
+public:
+    /**
+     * Construct the thread
+     */
+    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();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline void Thread::sleep(unsigned millis)
+{
+    usleep(static_cast<useconds_t>(millis)*1000);
+}
+
+//------------------------------------------------------------------------------
+
+inline Thread::Thread(bool detached) :
+    detached(detached)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline Thread::~Thread()
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline void Thread::join()
+{
+    pthread_join(thread, 0);
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_POSIX_THREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_posix/Thread.h
===================================================================
--- src/hu/varadiistvan/scpl/_posix/Thread.h	(revision 1)
+++ 	(revision )
@@ -1,138 +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_POSIX_THREAD_H
-#define HU_VARADIISTVAN_SCPL_POSIX_THREAD_H
-//------------------------------------------------------------------------------
-
-#include <pthread.h>
-#include <unistd.h>
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-/**
- * A pthreads-based thread implementation.
- */
-class Thread
-{
-public:
-    /**
-     * Sleep for the given number of milliseconds.
-     */
-    static void sleep(unsigned millis);
-
-private:
-    /**
-     * The thread-runner function.
-     */
-    static void* threadFn(void* arg);
-
-    /**
-     * Indicate if the thread is detached or not.
-     */
-    bool detached;
-
-    /**
-     * The posix thread handle.
-     */
-    pthread_t thread;
-
-public:
-    /**
-     * Construct the thread
-     */
-    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();
-};
-
-//------------------------------------------------------------------------------
-// Inline definitions
-//------------------------------------------------------------------------------
-
-inline void Thread::sleep(unsigned millis)
-{
-    usleep(static_cast<useconds_t>(millis)*1000);
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::Thread(bool detached) :
-    detached(detached)
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline Thread::~Thread()
-{
-}
-
-//------------------------------------------------------------------------------
-
-inline void Thread::join()
-{
-    pthread_join(thread, 0);
-}
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_SCPL_POSIX_THREAD_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
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/CondVar.cc
===================================================================
--- src/hu/varadiistvan/scpl/_win32/CondVar.cc	(revision 5)
+++ src/hu/varadiistvan/scpl/_win32/CondVar.cc	(revision 5)
@@ -0,0 +1,87 @@
+// 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 "CondVar.h"
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::scpl::CondVar;
+
+//------------------------------------------------------------------------------
+
+bool CondVar::wait(Mutex& inMutex, int timeout)
+{
+    mutex.lock();
+    ++numWaiters;
+    size_t generation = waitGeneration;
+    mutex.unlock();
+
+    inMutex.unlock();
+
+    bool lastWaiter = false;
+    bool wokenUp = false;
+    bool waitDone = false;
+    while (!waitDone) {
+        int result = WaitForSingleObject(event,
+                                         (timeout<0) ? INFINITE : timeout);
+        if (result==WAIT_OBJECT_0) {
+            mutex.lock();
+            waitDone = numToRelease>0 && generation!=waitGeneration;
+            if (waitDone) {
+                --numToRelease;
+                lastWaiter = numToRelease == 0;
+                wokenUp = true;
+            }
+            mutex.unlock();
+        } else {
+            waitDone = true;
+        }
+    }
+
+    inMutex.lock();
+
+    mutex.lock();
+    --numWaiters;
+    mutex.unlock();
+
+    if (lastWaiter) {
+        ResetEvent(event);
+    }
+
+    return wokenUp;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_win32/CondVar.h
===================================================================
--- src/hu/varadiistvan/scpl/_win32/CondVar.h	(revision 5)
+++ src/hu/varadiistvan/scpl/_win32/CondVar.h	(revision 5)
@@ -0,0 +1,168 @@
+// 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_CONDVAR_H
+#define HU_VARADIISTVAN_SCPL_CONDVAR_H
+//------------------------------------------------------------------------------
+
+#include "Mutex.h"
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+
+/**
+ * A condition variable for the Win32 API.
+ *
+ * Note: the CONDITION_VARIABLE structure and the associated functions
+ * are available only starting with the Windows Vista API. However,
+ * for the time being we also want to support Windows XP, hence this
+ * rather fancy implementation.
+ */
+class CondVar
+{
+private:
+    /**
+     * The mutex protecting the internal data structures.
+     */
+    Mutex mutex;
+
+    /**
+     * The number of waiters.
+     */
+    size_t numWaiters;
+
+    /**
+     * The wait generation.
+     */
+    size_t waitGeneration;
+
+    /**
+     * The number of waiters to release.
+     */
+    size_t numToRelease;
+
+    /**
+     * The event to use for waiting.
+     */
+    HANDLE event;
+
+public:
+    /**
+     * Construct the condition variable.
+     */
+    CondVar();
+
+    /**
+     * Destroy the condition variable.
+     */
+    ~CondVar();
+
+    /**
+     * Wait for the condition variable.
+     *
+     * @param mutex the mutex to unlock and re-lock.
+     * @param timeout the number of milliseconds to wait at most. If
+     * negative, the function will wait indefinitely.
+     *
+     * @return true, if the condition variable was signalled, false
+     * if a timeout occured
+     */
+    bool wait(Mutex& inMutex, int timeout = -1);
+
+    /**
+     * Signal the condition variable to wake up one thread.
+     */
+    void signal();
+
+    /**
+     * Signal all threads waiting on the condition variable.
+     */
+    void broadcast();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline CondVar::CondVar() :
+    numWaiters(0),
+    waitGeneration(0),
+    numToRelease(0)
+{
+    event  = CreateEvent(0, true, false, 0);
+}
+
+//------------------------------------------------------------------------------
+
+inline CondVar::~CondVar()
+{
+    CloseHandle(event);
+}
+
+//------------------------------------------------------------------------------
+
+inline void CondVar::signal()
+{
+    mutex.lock();
+    if (numWaiters>numToRelease) {
+        SetEvent(event);
+        ++numToRelease;
+        ++waitGeneration;
+    }
+    mutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+inline void CondVar::broadcast()
+{
+    mutex.lock();
+    if (numWaiters>0) {
+        SetEvent(event);
+        numToRelease = numWaiters;
+        ++waitGeneration;
+    }
+    mutex.unlock();
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_CONDVAR_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/_win32/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Makefile.am	(revision 5)
+++ src/hu/varadiistvan/scpl/_win32/Makefile.am	(revision 5)
@@ -0,0 +1,10 @@
+noinst_LTLIBRARIES=libvscpl_win32.la
+
+libvscpl_win32_la_SOURCES =	\
+	Thread.cc		\
+	CondVar.cc
+
+include_win32_posixdir=$(includedir)/hu/varadiistvan/scpl/_win32
+include_win32_posix_HEADERS=\
+	Thread.h		\
+	CondVar.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/Mutex.h
===================================================================
--- src/hu/varadiistvan/scpl/_win32/Mutex.h	(revision 4)
+++ 	(revision )
@@ -1,132 +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_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:
Index: src/hu/varadiistvan/scpl/config.h.in
===================================================================
--- src/hu/varadiistvan/scpl/config.h.in	(revision 1)
+++ src/hu/varadiistvan/scpl/config.h.in	(revision 1)
@@ -0,0 +1,10 @@
+// Define to 1, if the library is compiled for the POSIX API
+#define TARGET_API_POSIX @TARGET_API_POSIX@
+
+// Define to 1, if the library is compiled for the 32- or 64-bit
+// Win32 API
+#define TARGET_API_WIN32 @TARGET_API_WIN32@
+
+// Define to 1, if the library is compiled for the 64-bit
+// Win32 API
+#define TARGET_API_WIN64 @TARGET_API_WIN64@
Index: src/hu/varadiistvan/scpl/config.h.in
===================================================================
--- src/hu/varadiistvan/scpl/config.h.in	(revision 1)
+++ 	(revision )
@@ -1,10 +1,0 @@
-// Define to 1, if the library is compiled for the POSIX API
-#define TARGET_API_POSIX @TARGET_API_POSIX@
-
-// Define to 1, if the library is compiled for the 32- or 64-bit
-// Win32 API
-#define TARGET_API_WIN32 @TARGET_API_WIN32@
-
-// Define to 1, if the library is compiled for the 64-bit
-// Win32 API
-#define TARGET_API_WIN64 @TARGET_API_WIN64@
Index: src/hu/varadiistvan/scpl/hgccwrapper
===================================================================
--- src/hu/varadiistvan/scpl/hgccwrapper	(revision 4)
+++ src/hu/varadiistvan/scpl/hgccwrapper	(revision 4)
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+# Create a skeleton of a wrapper header for a certain class
+
+classname=$1
+uppername=`echo ${classname} | tr a-z A-Z`
+
+cat > "${classname}.h" <<EOF
+// 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_${uppername}_H
+#define HU_VARADIISTVAN_SCPL__${uppername}_H
+//------------------------------------------------------------------------------
+
+#if 0 // The public interface of ${classname}
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl {
+
+//------------------------------------------------------------------------------
+
+class ${classname}
+{
+public:
+};
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+
+#endif // 0, The public interface of ${classname}
+
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+//------------------------------------------------------------------------------
+
+#if TARGET_API_POSIX
+
+#include "_posix/${classname}.h"
+
+//------------------------------------------------------------------------------
+
+#elif TARGET_API_WIN32 || TARGET_API_WIN64
+
+#include "_win32/${classname}.h"
+
+//------------------------------------------------------------------------------
+
+#else
+
+#error "Not implemented for this target!"
+
+#endif
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_${uppername}_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
+EOF
+
+hg add "${classname}.h"
Index: src/hu/varadiistvan/scpl/hgccwrapper
===================================================================
--- src/hu/varadiistvan/scpl/hgccwrapper	(revision 4)
+++ 	(revision )
@@ -1,96 +1,0 @@
-#!/bin/sh
-
-# Create a skeleton of a wrapper header for a certain class
-
-classname=$1
-uppername=`echo ${classname} | tr a-z A-Z`
-
-cat > "${classname}.h" <<EOF
-// 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_${uppername}_H
-#define HU_VARADIISTVAN_SCPL__${uppername}_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of ${classname}
-
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace scpl {
-
-//------------------------------------------------------------------------------
-
-class ${classname}
-{
-public:
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of ${classname}
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_POSIX
-
-#include "_posix/${classname}.h"
-
-//------------------------------------------------------------------------------
-
-#elif TARGET_API_WIN32 || TARGET_API_WIN64
-
-#include "_win32/${classname}.h"
-
-//------------------------------------------------------------------------------
-
-#else
-
-#error "Not implemented for this target!"
-
-#endif
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_SCPL_${uppername}_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
-EOF
-
-hg add "${classname}.h"
