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(); }
public void RemoveComponent(GameComponent component) { RemovalMutex.WaitOne(); Removals.Add(component); RemovalMutex.ReleaseMutex(); }