Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ImmutableInterlocked.cs
Go to the documentation of this file.
5
7
8public static class ImmutableInterlocked
9{
10 public static bool Update<T>(ref T location, Func<T, T> transformer) where T : class?
11 {
12 Requires.NotNull(transformer, "transformer");
13 T val = Volatile.Read(ref location);
14 bool flag;
15 do
16 {
17 T val2 = transformer(val);
18 if (val == val2)
19 {
20 return false;
21 }
23 flag = val == val3;
24 val = val3;
25 }
26 while (!flag);
27 return true;
28 }
29
31 {
32 Requires.NotNull(transformer, "transformer");
33 T val = Volatile.Read(ref location);
34 bool flag;
35 do
36 {
38 if (val == val2)
39 {
40 return false;
41 }
43 flag = val == val3;
44 val = val3;
45 }
46 while (!flag);
47 return true;
48 }
49
51 {
52 Requires.NotNull(transformer, "transformer");
53 T[] array = Volatile.Read(ref Unsafe.AsRef(in location.array));
54 bool flag;
55 do
56 {
58 if (array == immutableArray.array)
59 {
60 return false;
61 }
63 flag = array == array2;
64 array = array2;
65 }
66 while (!flag);
67 return true;
68 }
69
71 {
72 Requires.NotNull(transformer, "transformer");
73 T[] array = Volatile.Read(ref Unsafe.AsRef(in location.array));
74 bool flag;
75 do
76 {
78 if (array == immutableArray.array)
79 {
80 return false;
81 }
83 flag = array == array2;
84 array = array2;
85 }
86 while (!flag);
87 return true;
88 }
89
94
99
101 {
102 return InterlockedCompareExchange(ref location, value, default(ImmutableArray<T>)).IsDefault;
103 }
104
117
130
150
174
197
217
238
258
260 {
262 bool flag;
263 do
264 {
265 Requires.NotNull(immutableStack, "location");
266 if (immutableStack.IsEmpty)
267 {
268 value = default(T);
269 return false;
270 }
275 }
276 while (!flag);
277 return true;
278 }
279
294
296 {
298 bool flag;
299 do
300 {
301 Requires.NotNull(immutableQueue, "location");
302 if (immutableQueue.IsEmpty)
303 {
304 value = default(T);
305 return false;
306 }
311 }
312 while (!flag);
313 return true;
314 }
315
330}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static ImmutableArray< T > InterlockedCompareExchange< T >(ref ImmutableArray< T > location, ImmutableArray< T > value, ImmutableArray< T > comparand)
static void Push< T >(ref ImmutableStack< T > location, T value)
static TValue GetOrAdd< TKey, TValue >(ref ImmutableDictionary< TKey, TValue > location, TKey key, Func< TKey, TValue > valueFactory)
static bool TryAdd< TKey, TValue >(ref ImmutableDictionary< TKey, TValue > location, TKey key, TValue value)
static bool TryRemove< TKey, TValue >(ref ImmutableDictionary< TKey, TValue > location, TKey key, [MaybeNullWhen(false)] out TValue value)
static ImmutableArray< T > InterlockedExchange< T >(ref ImmutableArray< T > location, ImmutableArray< T > value)
static bool TryDequeue< T >(ref ImmutableQueue< T > location, [MaybeNullWhen(false)] out T value)
static void Enqueue< T >(ref ImmutableQueue< T > location, T value)
static bool InterlockedInitialize< T >(ref ImmutableArray< T > location, ImmutableArray< T > value)
static bool TryPop< T >(ref ImmutableStack< T > location, [MaybeNullWhen(false)] out T value)
static TValue GetOrAdd< TKey, TValue, TArg >(ref ImmutableDictionary< TKey, TValue > location, TKey key, Func< TKey, TArg, TValue > valueFactory, TArg factoryArgument)
static bool Update< T, TArg >(ref T location, Func< T, TArg, T > transformer, TArg transformerArgument)
static bool TryUpdate< TKey, TValue >(ref ImmutableDictionary< TKey, TValue > location, TKey key, TValue newValue, TValue comparisonValue)
static bool Update< T >(ref T location, Func< T, T > transformer)
static TValue AddOrUpdate< TKey, TValue >(ref ImmutableDictionary< TKey, TValue > location, TKey key, Func< TKey, TValue > addValueFactory, Func< TKey, TValue, TValue > updateValueFactory)
static int CompareExchange(ref int location1, int value, int comparand)
static int Exchange(ref int location1, int value)
static bool Read(ref bool location)
Definition Volatile.cs:67