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
- IndicShape.cs
- SchemaMerger.cs
- DropShadowBitmapEffect.cs
- FamilyTypeface.cs
- QueryOperationResponseOfT.cs
- TextProviderWrapper.cs
- SQLInt64.cs
- FieldAccessException.cs
- GridSplitterAutomationPeer.cs
- StaticDataManager.cs
- DataGridCellInfo.cs
- TokenizerHelper.cs
- SeverityFilter.cs
- HandleDictionary.cs
- WorkflowApplication.cs
- ConfigurationSectionCollection.cs
- ResourceSet.cs
- AuthenticationModuleElementCollection.cs
- SafeArrayRankMismatchException.cs
- ClockController.cs
- ChineseLunisolarCalendar.cs
- MaterialCollection.cs
- PrimarySelectionAdorner.cs
- basecomparevalidator.cs
- PaperSource.cs
- TreeIterators.cs
- DynamicUpdateCommand.cs
- AnnotationComponentChooser.cs
- CollectionsUtil.cs
- AspCompat.cs
- BoolExpression.cs
- HttpSessionStateWrapper.cs
- Stack.cs
- ObjectIDGenerator.cs
- GeneralTransformGroup.cs
- TextAction.cs
- HtmlFormWrapper.cs
- SiteMapNodeItemEventArgs.cs
- BindingCollection.cs
- DataControlImageButton.cs
- DocumentOrderComparer.cs
- TypeSemantics.cs
- SqlDataSourceConfigureSelectPanel.cs
- MeshGeometry3D.cs
- DocumentOutline.cs
- PageFunction.cs
- FormViewUpdateEventArgs.cs
- ResXResourceWriter.cs
- BitArray.cs
- XPathScanner.cs
- XMLDiffLoader.cs
- DataGridViewBand.cs
- EdmFunctionAttribute.cs
- InvalidPrinterException.cs
- CachingParameterInspector.cs
- HtmlTextViewAdapter.cs
- TextElementAutomationPeer.cs
- DataContractSerializerOperationGenerator.cs
- GlyphsSerializer.cs
- QuaternionAnimationBase.cs
- TogglePatternIdentifiers.cs
- RowVisual.cs
- ConfigsHelper.cs
- OutOfProcStateClientManager.cs
- Error.cs
- EncodingFallbackAwareXmlTextWriter.cs
- SqlTriggerContext.cs
- EndpointInstanceProvider.cs
- SelectionItemProviderWrapper.cs
- ColorTransform.cs
- TextOutput.cs
- WinCategoryAttribute.cs
- WebWorkflowRole.cs
- RelatedCurrencyManager.cs
- ListViewDataItem.cs
- shaperfactoryquerycacheentry.cs
- mactripleDES.cs
- XamlInt32CollectionSerializer.cs
- FixedSOMTable.cs
- ProfileBuildProvider.cs
- ProjectionPlanCompiler.cs
- DomainUpDown.cs
- TableLayoutPanelCodeDomSerializer.cs
- GB18030Encoding.cs
- ProcessRequestAsyncResult.cs
- TextModifier.cs
- Expressions.cs
- ToolStripLocationCancelEventArgs.cs
- RealizedColumnsBlock.cs
- ValidationError.cs
- SpinWait.cs
- ViewManager.cs
- PermissionListSet.cs
- ActionMismatchAddressingException.cs
- SafeRightsManagementPubHandle.cs
- InstanceData.cs
- ExpressionConverter.cs
- ParameterElement.cs
- OperationCanceledException.cs
- ItemAutomationPeer.cs