public void Clear() { using (m_lock.Acquire()) { m_queue.Clear(); }; }
public void Clear() { using (m_lock.Acquire()) { m_set.Clear(); }; }
/// <summary> /// Refresh data from render (visible objects, render messages) /// </summary> public void BeforeUpdate() { using (m_lock.Acquire()) { m_outputVisibleObjects.RefreshRead(); // TODO: OP! This is wrong sync, but it's enough for existing output messages (we can get only half of these messages and second half next frame) m_outputRenderMessages.Commit(); } }
/// <summary>Returns true when new item was allocated</summary> public bool AllocateOrCreate(out Droplet droplet) { using (_activeLock.Acquire()) { var flag = currentUsed < _baseCapacity; droplet = flag ? _unused[currentUsed++] : IncreaseQueueSize(); _active.Add(droplet); return(flag); } }
/// <summary>O(1)</summary> public bool Add(T item) { using (_lock.Acquire()) { if (!_hashSet.Add(item)) { return(false); } _list.Add(item); return(true); } }
public StoragePin Pin() { using (m_pinLock.Acquire()) { if (Closed) { return(default(StoragePin)); } m_pinCount++; return(new StoragePin(this)); } }
public IDisposable Pin() { using (m_pinLock.Acquire()) { if (Closed) { return(null); } m_pinCount++; return(new StoragePin(this)); } }
/// <summary> /// Returns true when new item was allocated /// </summary> public bool AllocateOrCreate(out T item) { bool create = (m_unused.Count == 0); if (create) { item = new T(); } else { item = m_unused.Dequeue(); } using (m_activeLock.Acquire()) { m_active.Add(item); } return(create); }
public void Wrap() { using (m_lock.Acquire()) { if (History.Count >= m_historyLength) { History.Dequeue(); } History.Enqueue(Current); Current = new T(); } }
public uint NextId() { using (m_lock.Acquire()) { if (m_reuseQueue.Count > m_protecionCount && CheckFirstItemTime()) { return(m_reuseQueue.Dequeue().Id); } else { return(++m_maxId); } } }
/// <summary>Returns true when new item was allocated</summary> public bool AllocateOrCreate(out T item) { bool flag = false; using (_activeLock.Acquire()) { flag = _unused.Count == 0; item = !flag?_unused.Dequeue() : _activator(); _active.Add(item); } return(flag); }
public void Clear() { using (m_setLock.Acquire()) using (m_changelistLock.Acquire()) { m_hashSet.Clear(); m_toAdd.Clear(); m_toRemove.Clear(); } }
public void Add(T entity) { using (m_cacheLock.Acquire()) { if (m_toRemove.Contains(entity)) { m_toRemove.Remove(entity); } else { m_toAdd.Add(entity); } } }
public TValue this[TKey key] { get { using (m_lock.Acquire()) { return(m_dictionary[key]); } } set { using (m_lock.Acquire()) { m_dictionary[key] = value; } } }
public void Enqueue(MyRenderMessageBase message) { using (m_lock.Acquire()) RenderInput.Add(message); }
public T this[int index] { get { using (m_listLock.Acquire()) return(m_list[index]); } }