1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00

Merge pull request dotnet/coreclr#140 from dotnet-bot/from-tfs

Merge changes from TFS

Commit migrated from 114eb57cab
This commit is contained in:
Matt Ellis 2015-02-07 16:00:27 -08:00
commit cc74195781
4 changed files with 25 additions and 25 deletions

View file

@ -0,0 +1 @@
This folder will be mirrored by the Git-TFS Mirror recursively.

View file

@ -25,7 +25,7 @@
namespace CorUnix
{
bool CriticalSectionSubSysInitialize(void);
void CriticalSectionSubSysInitialize(void);
void InternalInitializeCriticalSectionAndSpinCount(
PCRITICAL_SECTION pCriticalSection,

View file

@ -137,7 +137,7 @@ PAL_Initialize(
int argc,
const char *argv[])
{
PAL_ERROR palError = NO_ERROR;
PAL_ERROR palError = ERROR_GEN_FAILURE;
CPalThread *pThread = NULL;
CSharedMemoryObjectManager *pshmom = NULL;
LPWSTR command_line = NULL;
@ -150,7 +150,7 @@ PAL_Initialize(
ENTRY will be called after the DBG channels initialization */
ENTRY_EXTERNAL("PAL_Initialize(argc = %d argv = %p)\n", argc, argv);
/*Firstly initiate a temporary lastError storage */
StartupLastError = 0;
StartupLastError = ERROR_GEN_FAILURE;
#ifdef __APPLE__
if (!RunningNatively())
@ -160,11 +160,7 @@ PAL_Initialize(
}
#endif // __APPLE__
if (!CriticalSectionSubSysInitialize())
{
// Too early to log a message
goto exit;
}
CriticalSectionSubSysInitialize();
if(NULL == init_critsec)
{
@ -293,6 +289,7 @@ PAL_Initialize(
if (!SEHInitializeMachExceptions())
{
ERROR("SEHInitializeMachExceptions failed!\n");
palError = ERROR_GEN_FAILURE;
goto CLEANUP1;
}
#endif // HAVE_MACH_EXCEPTIONS
@ -367,6 +364,8 @@ PAL_Initialize(
g_pSynchronizationManager =
CPalSynchMgrController::CreatePalSynchronizationManager(pThread);
palError = ERROR_GEN_FAILURE;
if (NULL == g_pSynchronizationManager)
{
ERROR("Failure creating synchronization manager\n");
@ -440,6 +439,8 @@ PAL_Initialize(
goto CLEANUP5;
}
palError = ERROR_GEN_FAILURE;
/* initialize structured exception handling stuff (signals, etc) */
if (FALSE == SEHInitialize(pThread))
{
@ -511,6 +512,8 @@ PAL_Initialize(
(void)PAL_Enter(PAL_BoundaryTop);
TRACE("Initialization count increases to %d\n", init_count.Load());
SetLastError(NO_ERROR);
retval = 0;
}
goto done;
@ -575,7 +578,14 @@ done:
_ASSERTE(pThread->suspensionInfo.IsSuspensionStateSafe());
}
exit:
if (retval != 0 && GetLastError() == ERROR_SUCCESS)
{
ASSERT("returning failure, but last error not set\n");
}
#ifdef __APPLE__
exit :
#endif // __APPLE__
LOGEXIT("PAL_Initialize returns int %d\n", retval);
return retval;
}

View file

@ -529,8 +529,12 @@ namespace CorUnix
Initializes CS subsystem
--*/
bool CriticalSectionSubSysInitialize()
void CriticalSectionSubSysInitialize()
{
static_assert(sizeof(CRITICAL_SECTION) >= sizeof(PAL_CRITICAL_SECTION),
"PAL fatal internal error: sizeof(CRITICAL_SECTION) is "
"smaller than sizeof(PAL_CRITICAL_SECTION)");
#ifdef _DEBUG
LONG lRet = InterlockedCompareExchange((LONG *)&csssInitState,
(LONG)CSSubSysInitializing,
@ -553,21 +557,6 @@ namespace CorUnix
}
}
#endif // _DEBUG
// In non-error conditions the optimizer should remove the following
// 'if' block, since the tested expression is verifiable at compile time
if (sizeof(CRITICAL_SECTION) < sizeof(PAL_CRITICAL_SECTION))
{
// Too early to log, writing directly to stderr
fprintf(stderr,
"PAL fatal internal error: sizeof(CRITICAL_SECTION)=%lu is "
"smaller than sizeof(PAL_CRITICAL_SECTION)=%lu\n",
sizeof(CRITICAL_SECTION),
sizeof(PAL_CRITICAL_SECTION));
return false;
}
return true;
}
/*++