public void Remove(MineObject mine) { using (_mineLock.ObtainUpgradeableReadLock()) { if (_mines.ContainsKey(mine.ID)) { using (_mineLock.ObtainWriteLock()) { _mines.Remove(mine.ID); } } } }
public void Add(MineObject mine) { using (_mineLock.ObtainUpgradeableReadLock()) { if (!_mines.ContainsKey(mine.ID)) { using (_mineLock.ObtainWriteLock()) { _mines.Add(mine.ID, mine); } } } }
public bool TryRemoveMine(MineObject mine) { lock (_checkMinesInRange) { return(_renderedMines.Remove(mine.ID)); } }