Alexandre Julliard : user32: Use a standard critical section instead of a syslevel for the USER lock.

Alexandre Julliard julliard at winehq.org
Mon Dec 28 09:16:02 CST 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Dec 24 17:42:19 2009 +0100

user32: Use a standard critical section instead of a syslevel for the USER lock.

---

 dlls/user32/user_main.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c
index 7868e19..a61a67d 100644
--- a/dlls/user32/user_main.c
+++ b/dlls/user32/user_main.c
@@ -39,14 +39,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(graphics);
 
 HMODULE user32_module = 0;
 
-static SYSLEVEL USER_SysLevel;
+static CRITICAL_SECTION user_section;
 static CRITICAL_SECTION_DEBUG critsect_debug =
 {
-    0, 0, &USER_SysLevel.crst,
+    0, 0, &user_section,
     { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
-      0, 0, { (DWORD_PTR)(__FILE__ ": USER_SysLevel") }
+      0, 0, { (DWORD_PTR)(__FILE__ ": user_section") }
 };
-static SYSLEVEL USER_SysLevel = { { &critsect_debug, -1, 0, 0, 0, 0 }, 2 };
+static CRITICAL_SECTION user_section = { &critsect_debug, -1, 0, 0, 0, 0 };
 
 static HPALETTE (WINAPI *pfnGDISelectPalette)( HDC hdc, HPALETTE hpal, WORD bkgnd );
 static UINT (WINAPI *pfnGDIRealizePalette)( HDC hdc );
@@ -62,7 +62,7 @@ extern void WDML_NotifyThreadDetach(void);
  */
 void USER_Lock(void)
 {
-    _EnterSysLevel( &USER_SysLevel );
+    EnterCriticalSection( &user_section );
 }
 
 
@@ -71,7 +71,7 @@ void USER_Lock(void)
  */
 void USER_Unlock(void)
 {
-    _LeaveSysLevel( &USER_SysLevel );
+    LeaveCriticalSection( &user_section );
 }
 
 
@@ -82,7 +82,11 @@ void USER_Unlock(void)
  */
 void USER_CheckNotLock(void)
 {
-    _CheckNotSysLevel( &USER_SysLevel );
+    if (user_section.OwningThread == ULongToHandle(GetCurrentThreadId()) && user_section.RecursionCount)
+    {
+        ERR( "BUG: holding USER lock\n" );
+        DebugBreak();
+    }
 }
 
 




More information about the wine-cvs mailing list