new version with fixes from Rob Richards Daniel

* threads.c: new version with fixes from Rob Richards
Daniel
diff --git a/threads.c b/threads.c
index 678977d..e803b62 100644
--- a/threads.c
+++ b/threads.c
@@ -109,8 +109,8 @@
 static DWORD mainthread;
 static struct
 {
-    int32 done;
-    int32; control;
+    DWORD done;
+    DWORD control;
 } run_once = { 0, 0 };
 /* endif HAVE_WIN32_THREADS */
 #elif defined HAVE_BEOS_THREADS
@@ -699,7 +699,7 @@
 
 #if defined(HAVE_WIN32_THREADS)
     if (!run_once.done) {
-        if (InterlockedIncrement(&run_once.control) == 0)
+        if (InterlockedIncrement(&run_once.control) == 1)
         {
 #if !defined(HAVE_COMPILER_TLS)
             globalkey = TlsAlloc();