Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Linq / Parallel / Merging / MergeEnumerator.cs / 1305376 / MergeEnumerator.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // MergeEnumerator.cs // //[....] // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Collections; using System.Collections.Generic; using System.Diagnostics.Contracts; namespace System.Linq.Parallel { ////// Convenience class used by enumerators that merge many partitions into one. /// ///internal abstract class MergeEnumerator : IEnumerator { protected QueryTaskGroupState m_taskGroupState; //------------------------------------------------------------------------------------ // Initializes a new enumerator with the specified group state. // protected MergeEnumerator(QueryTaskGroupState taskGroupState) { Contract.Assert(taskGroupState != null); m_taskGroupState = taskGroupState; } //----------------------------------------------------------------------------------- // Abstract members of IEnumerator that must be implemented by concrete subclasses. // public abstract TInputOutput Current { get; } public abstract bool MoveNext(); //----------------------------------------------------------------------------------- // Straightforward IEnumerator methods. So subclasses needn't bother. // object IEnumerator.Current { get { return ((IEnumerator )this).Current; } } public virtual void Reset() { // (intentionally left blank) } //----------------------------------------------------------------------------------- // If the enumerator is disposed of before the query finishes, we need to ensure // we properly tear down the query such that exceptions are not lost. // public virtual void Dispose() { // If the enumerator is being disposed of before the query has finished, // we will wait for the query to finish. Cancellation should have already // been initiated, so we just need to ensure exceptions are propagated. if (!m_taskGroupState.IsAlreadyEnded) { Contract.Assert(m_taskGroupState.CancellationState.TopLevelDisposedFlag.Value); m_taskGroupState.QueryEnd(true); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== // =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ // // MergeEnumerator.cs // // [....] // // =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- using System.Collections; using System.Collections.Generic; using System.Diagnostics.Contracts; namespace System.Linq.Parallel { ////// Convenience class used by enumerators that merge many partitions into one. /// ///internal abstract class MergeEnumerator : IEnumerator { protected QueryTaskGroupState m_taskGroupState; //------------------------------------------------------------------------------------ // Initializes a new enumerator with the specified group state. // protected MergeEnumerator(QueryTaskGroupState taskGroupState) { Contract.Assert(taskGroupState != null); m_taskGroupState = taskGroupState; } //----------------------------------------------------------------------------------- // Abstract members of IEnumerator that must be implemented by concrete subclasses. // public abstract TInputOutput Current { get; } public abstract bool MoveNext(); //----------------------------------------------------------------------------------- // Straightforward IEnumerator methods. So subclasses needn't bother. // object IEnumerator.Current { get { return ((IEnumerator )this).Current; } } public virtual void Reset() { // (intentionally left blank) } //----------------------------------------------------------------------------------- // If the enumerator is disposed of before the query finishes, we need to ensure // we properly tear down the query such that exceptions are not lost. // public virtual void Dispose() { // If the enumerator is being disposed of before the query has finished, // we will wait for the query to finish. Cancellation should have already // been initiated, so we just need to ensure exceptions are propagated. if (!m_taskGroupState.IsAlreadyEnded) { Contract.Assert(m_taskGroupState.CancellationState.TopLevelDisposedFlag.Value); m_taskGroupState.QueryEnd(true); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ObservableDictionary.cs
- WebPartsPersonalization.cs
- PageRouteHandler.cs
- NotSupportedException.cs
- __Filters.cs
- MILUtilities.cs
- BitmapMetadataBlob.cs
- SystemResources.cs
- InheritablePropertyChangeInfo.cs
- FixedSOMPageElement.cs
- WindowsFormsSectionHandler.cs
- FragmentQueryKB.cs
- DefaultParameterValueAttribute.cs
- SiteMembershipCondition.cs
- InitializationEventAttribute.cs
- _LazyAsyncResult.cs
- ColorTransform.cs
- EdmConstants.cs
- ListenerBinder.cs
- TransportSecurityProtocolFactory.cs
- HttpVersion.cs
- HttpPostedFileBase.cs
- PhoneCallDesigner.cs
- DoubleLinkListEnumerator.cs
- GeometryGroup.cs
- TokenCreationParameter.cs
- ScriptRegistrationManager.cs
- TransformationRules.cs
- WSSecurityXXX2005.cs
- HtmlTableCell.cs
- WebPartDesigner.cs
- TableColumnCollectionInternal.cs
- WCFModelStrings.Designer.cs
- ListViewSortEventArgs.cs
- FlowLayoutPanel.cs
- WebCategoryAttribute.cs
- DrawingGroupDrawingContext.cs
- ColorMap.cs
- PackageDigitalSignature.cs
- RuntimeConfigurationRecord.cs
- ConfigurationSectionGroup.cs
- RuleProcessor.cs
- SparseMemoryStream.cs
- OleDbReferenceCollection.cs
- PositiveTimeSpanValidatorAttribute.cs
- PageVisual.cs
- FileSystemInfo.cs
- BrowserCapabilitiesFactory.cs
- MimeTypeAttribute.cs
- Compiler.cs
- ToolTip.cs
- TraceSection.cs
- DataTableMappingCollection.cs
- Variant.cs
- TypeDescriptor.cs
- Repeater.cs
- AttachedAnnotationChangedEventArgs.cs
- FileUtil.cs
- WindowsSpinner.cs
- ActivitySurrogate.cs
- EndpointAddressElementBase.cs
- Closure.cs
- InputGestureCollection.cs
- ListBox.cs
- SafeNativeMemoryHandle.cs
- SystemUdpStatistics.cs
- XmlSchemaValidator.cs
- SequenceFullException.cs
- SearchForVirtualItemEventArgs.cs
- PanelDesigner.cs
- SqlTypeConverter.cs
- WebControlAdapter.cs
- BitmapSizeOptions.cs
- UnsafeNativeMethods.cs
- NullableConverter.cs
- AssemblyResolver.cs
- MarkupWriter.cs
- RelationshipFixer.cs
- QueryCacheKey.cs
- SelectionList.cs
- BaseComponentEditor.cs
- BitmapEffectDrawingContent.cs
- UdpSocketReceiveManager.cs
- Dynamic.cs
- Serializer.cs
- WebPartTracker.cs
- SqlDataReader.cs
- TextElement.cs
- BitStack.cs
- DES.cs
- DataList.cs
- SafeNativeMethods.cs
- InsufficientExecutionStackException.cs
- FillBehavior.cs
- IOException.cs
- XmlDataSourceView.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CatalogPartChrome.cs
- assertwrapper.cs
- AvTrace.cs