private void Seal() { m_writer.Dispose(); // Calling GetBuffer has side effect of making sure m_buffer is defined. Analysis.IgnoreResult(GetBuffer()); m_stream.Dispose(); m_writer = null; m_stream = null; }
/// <summary> /// Ensures that the given name is in this set. /// </summary> public void Add(HierarchicalNameId name) { Contract.Requires(name.IsValid); if (m_added.TryAdd(name, Unit.Void)) { // TODO: Since we can atomically know the set of previous flags, it would be much nicer if we avoided // using m_added at all in the common case (i.e., only a single scheduler instance is using flags) Analysis.IgnoreResult(m_nameTable.SetFlags(name, m_memberFlags)); } }
/// <summary> /// Adds a mapping from the given name to the given value, returning either the existing value or a newly added one. /// The semantics are the same as <see cref="ConcurrentDictionary{TKey,TValue}.GetOrAdd(TKey,System.Func{TKey,TValue})"/> /// </summary> public TValue GetOrAdd(HierarchicalNameId name, Func <HierarchicalNameId, TValue> valueFactory) { Contract.Requires(name.IsValid); TValue effectiveValue = m_map.GetOrAdd(name, valueFactory); // TODO: Since we can atomically know the set of previous flags, it would be much nicer if we avoided // using m_added at all in the common case (i.e., only a single scheduler instance is using flags) Analysis.IgnoreResult(m_nameTable.SetFlags(name, m_memberFlags)); return(effectiveValue); }