private void AddRemove() { DataLock.WaitOne(); foreach (InstanceData t in Additions) { Data.Add(t); } foreach (InstanceData t in Removals) { Data.Remove(t); } Additions.Clear(); Removals.Clear(); DataLock.ReleaseMutex(); }
public void HandleAddRemoves() { AdditionMutex.WaitOne(); foreach (GameComponent component in Additions) { AddComponentImmediate(component); } Additions.Clear(); AdditionMutex.ReleaseMutex(); RemovalMutex.WaitOne(); foreach (GameComponent component in Removals) { RemoveComponentImmediate(component); } Removals.Clear(); RemovalMutex.ReleaseMutex(); }