thanks.  try this patch.
        /r$

-- 
Rich Salz                  Chief Security Architect
DataPower Technology       http://www.datapower.com
XS40 XML Security Gateway  http://www.datapower.com/products/xs40.html
*** threads.c.orig      Thu Feb 24 10:06:35 2005
--- threads.c   Thu Feb 24 11:28:15 2005
***************
*** 107,113 ****
  static DWORD globalkey = TLS_OUT_OF_INDEXES;
  #endif /* HAVE_COMPILER_TLS */
  static DWORD mainthread;
! static int run_once_init = 1;
  /* endif HAVE_WIN32_THREADS */
  #elif defined HAVE_BEOS_THREADS
  int32 globalkey = 0;
--- 107,117 ----
  static DWORD globalkey = TLS_OUT_OF_INDEXES;
  #endif /* HAVE_COMPILER_TLS */
  static DWORD mainthread;
! static struct
! {
!     DWORD done;
!     DWORD control;
! } run_once = { 0, 0 };
  /* endif HAVE_WIN32_THREADS */
  #elif defined HAVE_BEOS_THREADS
  int32 globalkey = 0;
***************
*** 480,489 ****
      xmlGlobalState *globalval;
      xmlGlobalStateCleanupHelperParams * p;
  
!     if (run_once_init) { 
!       run_once_init = 0; 
!       xmlOnceInit(); 
!     }
  #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
      globalval = (xmlGlobalState *)TlsGetValue(globalkey);
  #else
--- 484,490 ----
      xmlGlobalState *globalval;
      xmlGlobalStateCleanupHelperParams * p;
  
!     xmlOnceInit();
  #if defined(LIBXML_STATIC) && !defined(LIBXML_STATIC_FOR_DLL)
      globalval = (xmlGlobalState *)TlsGetValue(globalkey);
  #else
***************
*** 574,585 ****
  #ifdef HAVE_PTHREAD_H
      pthread_once(&once_control, xmlOnceInit);
  #elif defined HAVE_WIN32_THREADS
!     if (run_once_init) { 
!       run_once_init = 0; 
!       xmlOnceInit (); 
!     }
  #elif defined HAVE_BEOS_THREADS
!       xmlOnceInit();
  #endif
          
  #ifdef DEBUG_THREADS
--- 575,583 ----
  #ifdef HAVE_PTHREAD_H
      pthread_once(&once_control, xmlOnceInit);
  #elif defined HAVE_WIN32_THREADS
!     xmlOnceInit (); 
  #elif defined HAVE_BEOS_THREADS
!     xmlOnceInit();
  #endif
          
  #ifdef DEBUG_THREADS
***************
*** 693,702 ****
  #endif
  
  #if defined(HAVE_WIN32_THREADS)
  #if !defined(HAVE_COMPILER_TLS)
!     globalkey = TlsAlloc();
  #endif
!     mainthread = GetCurrentThreadId();
  #endif
  
  #ifdef HAVE_BEOS_THREADS
--- 691,712 ----
  #endif
  
  #if defined(HAVE_WIN32_THREADS)
+     if (!run_once.done) {
+         if (InterlockedIncrement(&run_once.control, 1) == 0)
+         {
  #if !defined(HAVE_COMPILER_TLS)
!             globalkey = TlsAlloc();
  #endif
!             mainthread = GetCurrentThreadId();
!             run_once.done = 1;
!         }
!         else {
!             /* Another thread is working; give up our slice and
!              * wait until they're done. */
!             while (!run_once.done)
!                 Sleep(0);
!         }
!     }
  #endif
  
  #ifdef HAVE_BEOS_THREADS
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to