Fix TSS code, fix CV for Win32 platform
This commit is contained in:
@@ -56,7 +56,7 @@ static void **dataFetch(void)
|
||||
if (!result)
|
||||
abort();
|
||||
|
||||
memset(result, 0, sizeof(sizeof(void *) * BH_MAX_TSS));
|
||||
memset(result, 0, sizeof(void *) * BH_MAX_TSS);
|
||||
if (pthread_setspecific(tssKey, result))
|
||||
abort();
|
||||
}
|
||||
|
||||
@@ -33,11 +33,13 @@ int BH_ConditionWaitFor(BH_Condition *condition,
|
||||
BH_Mutex *mutex,
|
||||
uint32_t timeout)
|
||||
{
|
||||
switch (SleepConditionVariableCS(&condition->handle, &mutex->handle, timeout))
|
||||
if (SleepConditionVariableCS(&condition->handle, &mutex->handle, timeout))
|
||||
return BH_OK;
|
||||
|
||||
switch (GetLastError())
|
||||
{
|
||||
case 0: return BH_ERROR;
|
||||
case ERROR_TIMEOUT: return BH_TIMEOUT;
|
||||
default: return BH_OK;
|
||||
default: return BH_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ static void __stdcall keyCleanup(void *data)
|
||||
/* Skip or remove TSS data */
|
||||
if (!data)
|
||||
return;
|
||||
else if (FlsSetValue(tssKey, NULL))
|
||||
else if (!FlsSetValue(tssKey, NULL))
|
||||
abort();
|
||||
|
||||
/* Lock cleanup table and call cleanups */
|
||||
@@ -58,8 +58,8 @@ static void **dataFetch(void)
|
||||
if (!result)
|
||||
abort();
|
||||
|
||||
memset(result, 0, sizeof(sizeof(void *) * BH_MAX_TSS));
|
||||
if (FlsSetValue(tssKey, result))
|
||||
memset(result, 0, sizeof(void *) * BH_MAX_TSS);
|
||||
if (!FlsSetValue(tssKey, result))
|
||||
abort();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user