public unsafe IntPtr GetMemoryBlockForValue(ThreadStaticFieldOffsets value) { using (LockHolder.Hold(_lock)) { IntPtr result; if (_allocatedBlocks.TryGetValue(value, out result)) { return(result); } result = MemoryHelpers.AllocateMemory(sizeof(ThreadStaticFieldOffsets)); *(ThreadStaticFieldOffsets *)(result.ToPointer()) = value; _allocatedBlocks.Add(value, result); return(result); } }
public static IntPtr GetPointerToThreadStaticFieldOffsets(ThreadStaticFieldOffsets value) { return(s_threadStaticFieldCookies.GetMemoryBlockForValue(value)); }