// Take a lock here since we don't want to allocate redundant objects which won't be collected
CrstHolder exposedClassLock(AppDomain::GetMethodTableExposedClassObjectLock());
- if (*pDest == NULL)
+ if (VolatileLoad(pDest) == NULL)
{
FrozenObjectHeapManager* foh = SystemDomain::GetFrozenObjectHeapManager();
Object* obj = foh->TryAllocateObject(g_pRuntimeTypeClass, g_pRuntimeTypeClass->GetBaseSize());
RUNTIMETYPEHANDLE handle = (RUNTIMETYPEHANDLE)obj;
// Set the bit to 1 (we'll have to reset it before use)
handle |= 1;
- *pDest = handle;
+ VolatileStore(pDest, handle);
}
}
else