forked from laicasaane/unity-supplements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDefaultConcurrentProviderDecorator.cs
More file actions
190 lines (130 loc) · 6.87 KB
/
Copy pathDefaultConcurrentProviderDecorator.cs
File metadata and controls
190 lines (130 loc) · 6.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using System.Collections.ArrayBased;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace System.Collections.Pooling.Concurrent
{
public struct DefaultConcurrentProviderDecorator : IConcurrentPoolProviderDecorator
{
public IConcurrentPoolProvider Provider { get; private set; }
public void Set(IConcurrentPoolProvider provider)
=> this.Provider = provider ?? throw new ArgumentNullException(nameof(provider));
public T Get<T>() where T : IConcurrentPoolProviderDecorator, new()
{
var decorator = new T();
decorator.Set(this);
return decorator;
}
public T[] Array1<T>(int size)
=> this.Provider.Array1<T>(size);
public T[] Array1<T>(long size)
=> Array1ConcurrentPool<T>.Get(size);
public ArrayDictionary<TKey, TValue> ArrayDictionary<TKey, TValue>()
=> this.Provider.ArrayDictionary<TKey, TValue>();
public ArrayList<T> ArrayList<T>()
=> this.Provider.ArrayList<T>();
public ConcurrentBag<T> ConcurrentBag<T>()
=> this.Provider.ConcurrentBag<T>();
public ConcurrentDictionary<TKey, TValue> ConcurrentDictionary<TKey, TValue>()
=> this.Provider.ConcurrentDictionary<TKey, TValue>();
public ConcurrentPool<T> ConcurrentPool<T>() where T : class, new()
=> this.Provider.ConcurrentPool<T>();
public ConcurrentQueue<T> ConcurrentQueue<T>()
=> this.Provider.ConcurrentQueue<T>();
public ConcurrentStack<T> ConcurrentStack<T>()
=> this.Provider.ConcurrentStack<T>();
public Dictionary<TKey, TValue> Dictionary<TKey, TValue>()
=> this.Provider.Dictionary<TKey, TValue>();
public HashSet<T> HashSet<T>()
=> this.Provider.HashSet<T>();
public List<T> List<T>()
=> this.Provider.List<T>();
public Queue<T> Queue<T>()
=> this.Provider.Queue<T>();
public Stack<T> Stack<T>()
=> this.Provider.Stack<T>();
public void Return<T>(T[] item)
=> this.Provider.Return(item);
public void Return<T>(params T[][] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<T[]> items)
=> this.Provider.Return(items);
public void Return<T>(List<T> item)
=> this.Provider.Return(item);
public void Return<T>(params List<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<List<T>> items)
=> this.Provider.Return(items);
public void Return<T>(ArrayList<T> item)
=> this.Provider.Return(item);
public void Return<T>(params ArrayList<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<ArrayList<T>> items)
=> this.Provider.Return(items);
public void Return<T>(bool shallowClear, ArrayList<T> item)
=> ArrayListConcurrentPool<T>.Return(shallowClear, item);
public void Return<T>(bool shallowClear, params ArrayList<T>[] items)
=> ArrayListConcurrentPool<T>.Return(shallowClear, items);
public void Return<T>(bool shallowClear, IEnumerable<ArrayList<T>> items)
=> ArrayListConcurrentPool<T>.Return(shallowClear, items);
public void Return<T>(HashSet<T> item)
=> this.Provider.Return(item);
public void Return<T>(params HashSet<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<HashSet<T>> items)
=> this.Provider.Return(items);
public void Return<T>(Queue<T> item)
=> this.Provider.Return(item);
public void Return<T>(params Queue<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<Queue<T>> items)
=> this.Provider.Return(items);
public void Return<T>(Stack<T> item)
=> this.Provider.Return(item);
public void Return<T>(params Stack<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<Stack<T>> items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(Dictionary<TKey, TValue> item)
=> this.Provider.Return(item);
public void Return<TKey, TValue>(params Dictionary<TKey, TValue>[] items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(IEnumerable<Dictionary<TKey, TValue>> items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(ArrayDictionary<TKey, TValue> item)
=> this.Provider.Return(item);
public void Return<TKey, TValue>(params ArrayDictionary<TKey, TValue>[] items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(IEnumerable<ArrayDictionary<TKey, TValue>> items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(bool shallowClear, ArrayDictionary<TKey, TValue> item)
=> ArrayDictionaryConcurrentPool<TKey, TValue>.Return(shallowClear, item);
public void Return<TKey, TValue>(bool shallowClear, params ArrayDictionary<TKey, TValue>[] items)
=> ArrayDictionaryConcurrentPool<TKey, TValue>.Return(shallowClear, items);
public void Return<TKey, TValue>(bool shallowClear, IEnumerable<ArrayDictionary<TKey, TValue>> items)
=> ArrayDictionaryConcurrentPool<TKey, TValue>.Return(shallowClear, items);
public void Return<T>(ConcurrentBag<T> item)
=> this.Provider.Return(item);
public void Return<T>(params ConcurrentBag<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<ConcurrentBag<T>> items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(ConcurrentDictionary<TKey, TValue> item)
=> this.Provider.Return(item);
public void Return<TKey, TValue>(params ConcurrentDictionary<TKey, TValue>[] items)
=> this.Provider.Return(items);
public void Return<TKey, TValue>(IEnumerable<ConcurrentDictionary<TKey, TValue>> items)
=> this.Provider.Return(items);
public void Return<T>(ConcurrentQueue<T> item)
=> this.Provider.Return(item);
public void Return<T>(params ConcurrentQueue<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<ConcurrentQueue<T>> items)
=> this.Provider.Return(items);
public void Return<T>(ConcurrentStack<T> item)
=> this.Provider.Return(item);
public void Return<T>(params ConcurrentStack<T>[] items)
=> this.Provider.Return(items);
public void Return<T>(IEnumerable<ConcurrentStack<T>> items)
=> this.Provider.Return(items);
}
}