Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 41)
+++ src/Makefile.am	(revision 0)
@@ -1,2 +1,2 @@
-SUBDIRS=hu
+SUBDIRS=xplcommon
 
Index: src/hu/Makefile.am
===================================================================
--- src/hu/Makefile.am	(revision 41)
+++ 	(revision )
@@ -1,2 +1,0 @@
-SUBDIRS=varadiistvan
-
Index: src/hu/varadiistvan/Makefile.am
===================================================================
--- src/hu/varadiistvan/Makefile.am	(revision 41)
+++ 	(revision )
@@ -1,2 +1,0 @@
-SUBDIRS=xplcommon
-
Index: src/hu/varadiistvan/xplcommon/.copyright
===================================================================
--- src/hu/varadiistvan/xplcommon/.copyright	(revision 41)
+++ 	(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/xplcommon/.namespace
===================================================================
--- src/hu/varadiistvan/xplcommon/.namespace	(revision 41)
+++ 	(revision )
@@ -1,3 +1,0 @@
-hu
-varadiistvan
-xplcommon
Index: src/hu/varadiistvan/xplcommon/.srcmessage
===================================================================
--- src/hu/varadiistvan/xplcommon/.srcmessage	(revision 41)
+++ 	(revision )
@@ -1,2 +1,0 @@
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
Index: src/hu/varadiistvan/xplcommon/Makefile.am
===================================================================
--- src/hu/varadiistvan/xplcommon/Makefile.am	(revision 48)
+++ 	(revision )
@@ -1,25 +1,0 @@
-AM_CPPFLAGS=@XPSDK_INCLUDES@
-
-if TARGET_API_POSIX
-AM_CPPFLAGS+=-DLIN
-AM_CXXFLAGS=-fPIC -fno-stack-protector
-endif
-
-if TARGET_API_WIN32
-AM_CPPFLAGS+=-DIBM
-AM_LDFLAGS=@XPSDK_LDFLAGS@ -no-undefined
-if TARGET_API_WIN64
-AM_LDFLAGS+=-lXPLM_64
-else
-AM_LDFLAGS+=-lXPLM
-endif
-endif
-
-lib_LTLIBRARIES=libxplcommon.la
-
-libxplcommon_la_SOURCES= \
-	Util.cc
-
-include_xplcommondir=$(includedir)/hu/varadiistvan/xplcommon
-include_xplcommon_HEADERS=\
-	Util.h
Index: src/hu/varadiistvan/xplcommon/Util.cc
===================================================================
--- src/hu/varadiistvan/xplcommon/Util.cc	(revision 41)
+++ 	(revision )
@@ -1,64 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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 "Util.h"
-
-#include <cstdarg>
-#include <cstdio>
-
-#include <XPLMUtilities.h>
-
-//------------------------------------------------------------------------------
-
-using hu::varadiistvan::xplcommon::Util;
-
-//------------------------------------------------------------------------------
-
-void Util::debug(const char* format, ...)
-{
-    va_list ap;
-    va_start(ap, format);
-
-    char buf[256];
-    vsnprintf(buf, sizeof(buf), format, ap);
-
-    va_end(ap);
-
-    XPLMDebugString(buf);
-}
-
-//------------------------------------------------------------------------------
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/xplcommon/Util.h
===================================================================
--- src/hu/varadiistvan/xplcommon/Util.h	(revision 41)
+++ 	(revision )
@@ -1,61 +1,0 @@
-// Copyright (c) 2013 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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_XPLCOMMON_UTIL_H
-#define HU_VARADIISTVAN_XPLCOMMON_UTIL_H
-//------------------------------------------------------------------------------
-
-namespace hu { namespace varadiistvan { namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-/**
- * General utilities.
- */
-class Util
-{
-public:
-    /**
-     * Output debug information into X-Plane's log.
-     */
-    static void debug(const char* format, ...);
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace hu::varadiistvan::xplcommon */ } /* namespace hu::varadiistvan */ } /* namespace hu */
-
-//------------------------------------------------------------------------------
-#endif // HU_VARADIISTVAN_XPLCOMMON_UTIL_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
Index: src/hu/varadiistvan/xplcommon/hgccwrapper
===================================================================
--- src/hu/varadiistvan/xplcommon/hgccwrapper	(revision 41)
+++ 	(revision )
@@ -1,101 +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) 2012 by István Váradi
-
-// This file is part of libxplcommon, a common utility library for
-// development related to X-Plane
-
-// 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 XPLCOMMON_${uppername}_H
-#define XPLCOMMON_${uppername}_H
-//------------------------------------------------------------------------------
-
-#if 0 // The public interface of ${classname}
-
-//------------------------------------------------------------------------------
-
-namespace xplcommon {
-
-//------------------------------------------------------------------------------
-
-class ${classname}
-{
-public:
-};
-
-//------------------------------------------------------------------------------
-
-} /* namespace xplcommon */
-
-//------------------------------------------------------------------------------
-
-#endif // 0, The public interface of ${classname}
-
-//------------------------------------------------------------------------------
-
-#include "config.h"
-
-//------------------------------------------------------------------------------
-
-#if TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "win32/${classname}.h"
-
-namespace xplcommon { typedef win32::${classname} ${classname}; }
-
-//------------------------------------------------------------------------------
-
-#else // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-
-#include "posix/${classname}.h"
-
-namespace xplcommon { typedef posix::${classname} ${classname}; }
-
-//------------------------------------------------------------------------------
-
-#endif // TARGET_API_WIN32
-
-//------------------------------------------------------------------------------
-#endif // XPLCOMMON_${uppername}_H
-
-// Local Variables:
-// mode: C++
-// c-basic-offset: 4
-// indent-tabs-mode: nil
-// End:
-EOF
-
-hg add "${classname}.h"
Index: src/xplcommon/.copyright
===================================================================
--- src/xplcommon/.copyright	(revision 0)
+++ src/xplcommon/.copyright	(revision 0)
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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/xplcommon/.namespace
===================================================================
--- src/xplcommon/.namespace	(revision 0)
+++ src/xplcommon/.namespace	(revision 0)
@@ -0,0 +1,1 @@
+xplcommon
Index: src/xplcommon/.srcmessage
===================================================================
--- src/xplcommon/.srcmessage	(revision 0)
+++ src/xplcommon/.srcmessage	(revision 0)
@@ -0,0 +1,2 @@
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
Index: src/xplcommon/Makefile.am
===================================================================
--- src/xplcommon/Makefile.am	(revision 0)
+++ src/xplcommon/Makefile.am	(revision 0)
@@ -0,0 +1,11 @@
+lib_LTLIBRARIES=libxplcommon.la
+
+libxplcommon_la_SOURCES=\
+	POSIXThread.cc	\
+	Win32Thread.cc
+
+include_xplcommondir=$(includedir)/xplcommon
+include_xplcommon_HEADERS=\
+	POSIXThread.h	\
+	Win32Thread.h	\
+	Thread.h
Index: src/xplcommon/POSIXThread.cc
===================================================================
--- src/xplcommon/POSIXThread.cc	(revision 0)
+++ src/xplcommon/POSIXThread.cc	(revision 0)
@@ -0,0 +1,63 @@
+// -*- coding: utf-8 -*-
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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 "config.h"
+#ifdef HAVE_PTHREAD_H
+
+//------------------------------------------------------------------------------
+
+#include "POSIXThread.h"
+
+//------------------------------------------------------------------------------
+
+using xplcommon::POSIXThread;
+
+//------------------------------------------------------------------------------
+
+void* POSIXThread::threadFn(void* arg)
+{
+    reinterpret_cast<POSIXThread*>(arg)->run();
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+#endif // HAVE_PTHREAD_H
+
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/POSIXThread.h
===================================================================
--- src/xplcommon/POSIXThread.h	(revision 0)
+++ src/xplcommon/POSIXThread.h	(revision 0)
@@ -0,0 +1,131 @@
+// -*- coding: utf-8 -*-
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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 XPLCOMMON_POSIXTHREAD_H
+#define XPLCOMMON_POSIXTHREAD_H
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+#ifdef HAVE_PTHREAD_H
+//------------------------------------------------------------------------------
+
+#include <pthread.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplcommon {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A pthreads-based thread implementation.
+ */
+class POSIXThread
+{
+private:
+    /**
+     * The thread-runner function.
+     */
+    static void* threadFn(void* arg);
+
+    /**
+     * The posix thread handle.
+     */
+    pthread_t thread;
+
+public:
+    /**
+     * Virtual destructor.
+     */
+    virtual ~POSIXThread();
+
+    /**
+     * 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();
+};
+
+//------------------------------------------------------------------------------
+
+/// Common type for OS-independent code
+typedef POSIXThread Thread;
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline POSIXThread::~POSIXThread()
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool POSIXThread::start()
+{
+    return pthread_create(&thread, 0, &threadFn, this)>=0;
+}
+
+//------------------------------------------------------------------------------
+
+inline void POSIXThread::join()
+{
+    pthread_join(thread, 0);
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplcommon */
+
+//------------------------------------------------------------------------------
+#endif // HAVE_PTHREAD_H
+
+#endif // XPLCOMMON_POSIXTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/Thread.h
===================================================================
--- src/xplcommon/Thread.h	(revision 0)
+++ src/xplcommon/Thread.h	(revision 0)
@@ -0,0 +1,56 @@
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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 XPLCOMMON_THREAD_H
+#define XPLCOMMON_THREAD_H
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+#ifdef HAVE_WINDOWS_H
+
+#include "Win32Thread.h"
+
+#else
+
+#include "POSIXThread.h"
+
+#endif
+
+//------------------------------------------------------------------------------
+#endif // XPLCOMMON_THREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/Win32Thread.cc
===================================================================
--- src/xplcommon/Win32Thread.cc	(revision 0)
+++ src/xplcommon/Win32Thread.cc	(revision 0)
@@ -0,0 +1,63 @@
+// -*- coding: utf-8 -*-
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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 "config.h"
+#ifdef HAVE_WINDOWS_H
+
+//------------------------------------------------------------------------------
+
+#include "Win32Thread.h"
+
+//------------------------------------------------------------------------------
+
+using xplcommon::Win32Thread;
+
+//------------------------------------------------------------------------------
+
+DWORD Win32Thread::threadFn(LPVOID arg)
+{
+    reinterpret_cast<Win32Thread*>(arg)->run();
+    return 0;
+}
+
+//------------------------------------------------------------------------------
+#endif // HAVE_PTHREAD_H
+
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/Win32Thread.h
===================================================================
--- src/xplcommon/Win32Thread.h	(revision 0)
+++ src/xplcommon/Win32Thread.h	(revision 0)
@@ -0,0 +1,133 @@
+// -*- coding: utf-8 -*-
+
+// Copyright (c) 2012 by István Váradi
+
+// This file is part of libxplcommon, a common utility library for
+// development related to X-Plane
+
+// Copyright (c) 2013, István Váradi
+// All rights reserved.
+
+// 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 XPLCOMMON_WIN32THREAD_H
+#define XPLCOMMON_WIN32THREAD_H
+//------------------------------------------------------------------------------
+
+#include "config.h"
+
+#ifdef HAVE_WINDOWS_H
+//------------------------------------------------------------------------------
+
+#include <windows.h>
+
+//------------------------------------------------------------------------------
+
+namespace xplcommon {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A Win32 API thread implementation.
+ */
+class Win32Thread
+{
+private:
+    /**
+     * The thread-runner function.
+     */
+    static DWORD WINAPI threadFn(LPVOID arg);
+
+    /**
+     * The thread handle.
+     */
+    HANDLE handle;
+
+public:
+    /**
+     * Virtual destructor.
+     */
+    virtual ~Win32Thread();
+
+    /**
+     * 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();
+};
+
+//------------------------------------------------------------------------------
+
+/// Common type for OS-independent code
+typedef Win32Thread Thread;
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline Win32Thread::~Win32Thread()
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline bool Win32Thread::start()
+{
+    handle = CreateThread(0, 0, &threadFn, this, 0, 0);
+    return handle!=0;
+}
+
+//------------------------------------------------------------------------------
+
+inline void Win32Thread::join()
+{
+    WaitForSingleObject(handle, INFINITE);
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace xplcommon */
+
+//------------------------------------------------------------------------------
+#endif // HAVE_PTHREAD_H
+
+#endif // XPLCOMMON_POSIXTHREAD_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/xplcommon/config.h.in
===================================================================
--- src/xplcommon/config.h.in	(revision 0)
+++ src/xplcommon/config.h.in	(revision 0)
@@ -0,0 +1,68 @@
+/* src/xplcommon/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
