new version with fixes from Rob Richards Daniel

* threads.c: new version with fixes from Rob Richards
Daniel
diff --git a/ChangeLog b/ChangeLog
index 6bf4604..0003509 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Feb 25 08:31:16 CET 2005 Daniel Veillard <daniel@veillard.com>
+
+	* threads.c: new version with fixes from Rob Richards
+
 Thu Feb 24 16:37:51 CET 2005 Daniel Veillard <daniel@veillard.com>
 
 	* threads.c: applied patch from Rich Salz for multithreading on
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();