Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Allocate()

T System.Reflection.Internal.ObjectPool< T >.Allocate ( )
inlinepackage

Definition at line 32 of file ObjectPool.cs.

33 {
34 Element[] items = _items;
35 int num = 0;
36 T val;
37 while (true)
38 {
39 if (num < items.Length)
40 {
41 val = items[num].Value;
42 if (val != null && val == Interlocked.CompareExchange(ref items[num].Value, null, val))
43 {
44 break;
45 }
46 num++;
47 continue;
48 }
49 val = CreateInstance();
50 break;
51 }
52 return val;
53 }
static int CompareExchange(ref int location1, int value, int comparand)

References System.Reflection.Internal.ObjectPool< T >._items, System.Threading.Interlocked.CompareExchange(), System.Reflection.Internal.ObjectPool< T >.CreateInstance(), and System.Reflection.Internal.ObjectPool< T >.Element.Value.