scripts
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System
|
||||
{
|
||||
/// <summary>Encapsulates a memory slot to store local data. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x02000680 RID: 1664
|
||||
[ComVisible(true)]
|
||||
public sealed class LocalDataStoreSlot
|
||||
{
|
||||
// Token: 0x06003EF8 RID: 16120 RVA: 0x000D529C File Offset: 0x000D349C
|
||||
internal LocalDataStoreSlot(bool in_thread)
|
||||
{
|
||||
this.thread_local = in_thread;
|
||||
object obj = LocalDataStoreSlot.lock_obj;
|
||||
lock (obj)
|
||||
{
|
||||
bool[] array;
|
||||
if (in_thread)
|
||||
{
|
||||
array = LocalDataStoreSlot.slot_bitmap_thread;
|
||||
}
|
||||
else
|
||||
{
|
||||
array = LocalDataStoreSlot.slot_bitmap_context;
|
||||
}
|
||||
int i;
|
||||
if (array != null)
|
||||
{
|
||||
for (i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (!array[i])
|
||||
{
|
||||
this.slot = i;
|
||||
array[i] = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
bool[] array2 = new bool[i + 2];
|
||||
array.CopyTo(array2, 0);
|
||||
array = array2;
|
||||
}
|
||||
else
|
||||
{
|
||||
array = new bool[2];
|
||||
i = 0;
|
||||
}
|
||||
array[i] = true;
|
||||
this.slot = i;
|
||||
if (in_thread)
|
||||
{
|
||||
LocalDataStoreSlot.slot_bitmap_thread = array;
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalDataStoreSlot.slot_bitmap_context = array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06003EFA RID: 16122 RVA: 0x000D5384 File Offset: 0x000D3584
|
||||
protected override void Finalize()
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.FreeLocalSlotValues(this.slot, this.thread_local);
|
||||
object obj = LocalDataStoreSlot.lock_obj;
|
||||
lock (obj)
|
||||
{
|
||||
if (this.thread_local)
|
||||
{
|
||||
LocalDataStoreSlot.slot_bitmap_thread[this.slot] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
LocalDataStoreSlot.slot_bitmap_context[this.slot] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
base.Finalize();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04001925 RID: 6437
|
||||
internal int slot;
|
||||
|
||||
// Token: 0x04001926 RID: 6438
|
||||
internal bool thread_local;
|
||||
|
||||
// Token: 0x04001927 RID: 6439
|
||||
private static object lock_obj = new object();
|
||||
|
||||
// Token: 0x04001928 RID: 6440
|
||||
private static bool[] slot_bitmap_thread;
|
||||
|
||||
// Token: 0x04001929 RID: 6441
|
||||
private static bool[] slot_bitmap_context;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user