Alexandre Julliard : ntdll: Move the LDT locking functions to the i386-specific code.

Alexandre Julliard julliard at winehq.org
Thu Dec 31 07:42:42 CST 2009


Module: wine
Branch: master
Commit: 82f393dda185a3f3356d930d3d42855c50718710
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=82f393dda185a3f3356d930d3d42855c50718710

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 29 22:10:50 2009 +0100

ntdll: Move the LDT locking functions to the i386-specific code.

---

 dlls/ntdll/signal_i386.c |   35 +++++++++++++++++++++++++++++++++++
 dlls/ntdll/thread.c      |   37 -------------------------------------
 2 files changed, 35 insertions(+), 37 deletions(-)

diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index a4bb95d..5a919b3 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2004,6 +2004,40 @@ int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh)
 }
 
 
+/***********************************************************************
+ *           locking for LDT routines
+ */
+static RTL_CRITICAL_SECTION ldt_section;
+static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
+{
+    0, 0, &ldt_section,
+    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
+      0, 0, { (DWORD_PTR)(__FILE__ ": ldt_section") }
+};
+static RTL_CRITICAL_SECTION ldt_section = { &critsect_debug, -1, 0, 0, 0, 0 };
+static sigset_t ldt_sigset;
+
+static void ldt_lock(void)
+{
+    sigset_t sigset;
+
+    pthread_sigmask( SIG_BLOCK, &server_block_set, &sigset );
+    RtlEnterCriticalSection( &ldt_section );
+    if (ldt_section.RecursionCount == 1) ldt_sigset = sigset;
+}
+
+static void ldt_unlock(void)
+{
+    if (ldt_section.RecursionCount == 1)
+    {
+        sigset_t sigset = ldt_sigset;
+        RtlLeaveCriticalSection( &ldt_section );
+        pthread_sigmask( SIG_SETMASK, &sigset, NULL );
+    }
+    else RtlLeaveCriticalSection( &ldt_section );
+}
+
+
 /**********************************************************************
  *		signal_alloc_thread
  */
@@ -2146,6 +2180,7 @@ void signal_init_process(void)
     if (sigaction( SIGUSR2, &sig_act, NULL ) == -1) goto error;
 #endif
 
+    wine_ldt_init_locking( ldt_lock, ldt_unlock );
     return;
 
  error:
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index c370651..929d443 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -66,40 +66,6 @@ static RTL_BITMAP fls_bitmap;
 static LIST_ENTRY tls_links;
 static int nb_threads = 1;
 
-static RTL_CRITICAL_SECTION ldt_section;
-static RTL_CRITICAL_SECTION_DEBUG critsect_debug =
-{
-    0, 0, &ldt_section,
-    { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
-      0, 0, { (DWORD_PTR)(__FILE__ ": ldt_section") }
-};
-static RTL_CRITICAL_SECTION ldt_section = { &critsect_debug, -1, 0, 0, 0, 0 };
-static sigset_t ldt_sigset;
-
-/***********************************************************************
- *           locking for LDT routines
- */
-static void ldt_lock(void)
-{
-    sigset_t sigset;
-
-    pthread_sigmask( SIG_BLOCK, &server_block_set, &sigset );
-    RtlEnterCriticalSection( &ldt_section );
-    if (ldt_section.RecursionCount == 1) ldt_sigset = sigset;
-}
-
-static void ldt_unlock(void)
-{
-    if (ldt_section.RecursionCount == 1)
-    {
-        sigset_t sigset = ldt_sigset;
-        RtlLeaveCriticalSection( &ldt_section );
-        pthread_sigmask( SIG_SETMASK, &sigset, NULL );
-    }
-    else RtlLeaveCriticalSection( &ldt_section );
-}
-
-
 /***********************************************************************
  *           get_unicode_string
  *
@@ -369,9 +335,6 @@ HANDLE thread_init(void)
         wine_server_fd_to_handle( 2, GENERIC_WRITE|SYNCHRONIZE, OBJ_INHERIT, &params.hStdError );
     }
 
-    /* initialize LDT locking */
-    wine_ldt_init_locking( ldt_lock, ldt_unlock );
-
     /* initialize time values in user_shared_data */
     NtQuerySystemTime( &now );
     user_shared_data->SystemTime.LowPart = now.u.LowPart;




More information about the wine-cvs mailing list