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

◆ SetLocalValue()

static void System.Threading.ExecutionContext.SetLocalValue ( IAsyncLocal local,
object newValue,
bool needChangeNotifications )
inlinestaticpackage

Definition at line 322 of file ExecutionContext.cs.

323 {
324 ExecutionContext executionContext = Thread.CurrentThread._executionContext;
325 object value = null;
326 bool flag = false;
327 if (executionContext != null)
328 {
329 flag = executionContext.m_localValues.TryGetValue(local, out value);
330 }
331 if (value == newValue)
332 {
333 return;
334 }
335 IAsyncLocal[] array = null;
336 bool flag2 = false;
337 IAsyncLocalValueMap asyncLocalValueMap;
338 if (executionContext != null)
339 {
340 flag2 = executionContext.m_isFlowSuppressed;
342 array = executionContext.m_localChangeNotifications;
343 }
344 else
345 {
346 asyncLocalValueMap = AsyncLocalValueMap.Create(local, newValue, !needChangeNotifications);
347 }
348 if (needChangeNotifications && !flag)
349 {
350 if (array == null)
351 {
352 array = new IAsyncLocal[1] { local };
353 }
354 else
355 {
356 int num = array.Length;
357 Array.Resize(ref array, num + 1);
358 array[num] = local;
359 }
360 }
363 {
364 local.OnValueChanged(value, newValue, contextChanged: false);
365 }
366 }

References System.Threading.ExecutionContext.ExecutionContext(), System.array, System.Threading.AsyncLocalValueMap.Create(), System.Threading.Thread.CurrentThread, System.Runtime.Serialization.Dictionary, System.Threading.AsyncLocalValueMap.IsEmpty(), System.Threading.IAsyncLocalValueMap.Set(), and System.value.