ThreadUtils
Automatically lock a variable using an In/Out api.
var ConcurrentValue<List<MyClass>> _myList = new ConcurrentValue<List<MyClass>>();
// sets In and Out value
myList.In = aList;
// gets the Out value
Debug.Log(myList.Out);
// work with the In value
var tmpValue = myList.In;
tmpValue.Add(...);
tmpValue.Add(...);
myList.In = tmpValue;
// safe read action
// copy
myList.Out.ToArray();
// or lock out
MyClass value = null;
myList.Exec(v => value = v.FirstOrDefault(s => ...));