[ros-diffs] [weiden] 13134: made SetErrorMode() thread-safe

weiden at svn.reactos.com weiden at svn.reactos.com
Wed Jan 19 20:14:59 CET 2005


made SetErrorMode() thread-safe
Modified: trunk/reactos/lib/kernel32/except/except.c
  _____  

Modified: trunk/reactos/lib/kernel32/except/except.c
--- trunk/reactos/lib/kernel32/except/except.c	2005-01-19 14:25:10 UTC
(rev 13133)
+++ trunk/reactos/lib/kernel32/except/except.c	2005-01-19 19:14:56 UTC
(rev 13134)
@@ -15,25 +15,18 @@

 #define NDEBUG
 #include "../include/debug.h"
 
-UINT GlobalErrMode = 0;
+UINT GlobalErrorMode = 0;
 LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter =
UnhandledExceptionFilter;
 
-UINT GetErrorMode(void)
-{
-	return GlobalErrMode;
-}
 
-
 /*
  * @implemented
  */
 UINT 
 STDCALL
-SetErrorMode(  UINT uMode  )
+SetErrorMode(UINT uMode)
 {
-	UINT OldErrMode = GetErrorMode();
-	GlobalErrMode = uMode;
-	return OldErrMode;
+   return (UINT)InterlockedExchange((LONG*)&GlobalErrorMode,
(LONG)uMode);
 }
 
 
@@ -121,7 +114,7 @@
       return EXCEPTION_CONTINUE_SEARCH;
    }
 
-   if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
+   if ((GlobalErrorMode & SEM_NOGPFAULTERRORBOX) == 0)
    {
 #ifdef _X86_
       PULONG Frame;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050119/57c32841/attachment.html


More information about the Ros-diffs mailing list