Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AllocFreeConcurrentStack.cs
Go to the documentation of this file.
3
5
6internal static class AllocFreeConcurrentStack<T>
7{
8 private static readonly Type s_typeOfT = typeof(T);
9
11 {
12 get
13 {
15 if (dictionary == null)
16 {
17 dictionary = (AllocFreeConcurrentStack.t_stacks = new Dictionary<Type, object>());
18 }
19 if (!dictionary.TryGetValue(s_typeOfT, out var value))
20 {
23 }
25 }
26 }
27
28 public static void TryAdd(T item)
29 {
31 if (threadLocalStack.Count < 35)
32 {
34 }
35 }
36
37 public static bool TryTake([MaybeNullWhen(false)] out T item)
38 {
40 if (threadLocalStack != null && threadLocalStack.Count > 0)
41 {
42 item = threadLocalStack.Pop().Value;
43 return true;
44 }
45 item = default(T);
46 return false;
47 }
48}
49internal static class AllocFreeConcurrentStack
50{
53}
void Add(TKey key, TValue value)
static bool TryTake([MaybeNullWhen(false)] out T item)