made SetErrorMode() thread-safe

svn path=/trunk/; revision=13134
This commit is contained in:
Thomas Bluemel 2005-01-19 19:14:56 +00:00
parent 5b0f6dccee
commit c0ff13e571

View file

@ -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 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo)
return EXCEPTION_CONTINUE_SEARCH;
}
if ((GetErrorMode() & SEM_NOGPFAULTERRORBOX) == 0)
if ((GlobalErrorMode & SEM_NOGPFAULTERRORBOX) == 0)
{
#ifdef _X86_
PULONG Frame;