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
- VirtualPath.cs
- TreeViewItem.cs
- ResourcePermissionBase.cs
- PagesSection.cs
- FileDialog.cs
- MdiWindowListItemConverter.cs
- Completion.cs
- ByteStack.cs
- StateBag.cs
- WizardStepBase.cs
- ServiceTimeoutsBehavior.cs
- SynchronizationFilter.cs
- BinaryFormatterWriter.cs
- httpserverutility.cs
- TableRow.cs
- XmlCountingReader.cs
- ClientRuntimeConfig.cs
- WorkItem.cs
- EnumMemberAttribute.cs
- LightweightCodeGenerator.cs
- Crypto.cs
- MetabaseServerConfig.cs
- Point3D.cs
- DesignerVerbCollection.cs
- CalendarDay.cs
- ObservableCollectionDefaultValueFactory.cs
- CmsInterop.cs
- Zone.cs
- List.cs
- BaseWebProxyFinder.cs
- RegexBoyerMoore.cs
- oledbconnectionstring.cs
- SQLGuid.cs
- PolyBezierSegment.cs
- MonthChangedEventArgs.cs
- Rect.cs
- PanelStyle.cs
- AutomationPropertyInfo.cs
- ComplexPropertyEntry.cs
- OleDbStruct.cs
- NamedPipeChannelFactory.cs
- OAVariantLib.cs
- TypeElementCollection.cs
- Page.cs
- MimePart.cs
- LiteralLink.cs
- InvariantComparer.cs
- errorpatternmatcher.cs
- TimeSpanMinutesConverter.cs
- LayoutEditorPart.cs
- SqlDataSourceSelectingEventArgs.cs
- SqlTypeSystemProvider.cs
- DebugController.cs
- TypeGeneratedEventArgs.cs
- TraceSection.cs
- MsmqTransportBindingElement.cs
- NativeObjectSecurity.cs
- LayoutEditorPart.cs
- CompleteWizardStep.cs
- XmlDownloadManager.cs
- ValidatorAttribute.cs
- ToolStripCustomTypeDescriptor.cs
- EntityCommandCompilationException.cs
- MethodCallTranslator.cs
- NativeMethods.cs
- MethodAccessException.cs
- PriorityRange.cs
- RegexStringValidatorAttribute.cs
- GZipUtils.cs
- WindowsStatusBar.cs
- DbConnectionPoolIdentity.cs
- PathSegment.cs
- FileDetails.cs
- ToolStripItem.cs
- DataListItem.cs
- TextSerializer.cs
- Exceptions.cs
- BulletDecorator.cs
- TrackingLocationCollection.cs
- ClientType.cs
- CqlErrorHelper.cs
- SerializableAttribute.cs
- DataObjectSettingDataEventArgs.cs
- SqlResolver.cs
- StylusSystemGestureEventArgs.cs
- DisplayInformation.cs
- TypeLoadException.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- UriSchemeKeyedCollection.cs
- QilPatternVisitor.cs
- ChannelServices.cs
- ExpressionLexer.cs
- Cast.cs
- MarkupObject.cs
- RenderContext.cs
- JsonReaderWriterFactory.cs
- BitmapInitialize.cs
- Odbc32.cs
- EntityDataSourceDataSelectionPanel.cs
- RuntimeComponentFilter.cs