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
- XmlSchemaAny.cs
- XsltConvert.cs
- RuleRef.cs
- LayoutSettings.cs
- SHA512.cs
- ECDsa.cs
- WebReferenceCollection.cs
- ISFTagAndGuidCache.cs
- DataGridItemCollection.cs
- CompensatableSequenceActivity.cs
- BoolExpressionVisitors.cs
- basenumberconverter.cs
- ComboBoxItem.cs
- Int64AnimationUsingKeyFrames.cs
- HelloOperation11AsyncResult.cs
- RoleGroup.cs
- EntityContainer.cs
- TextParaClient.cs
- sqlstateclientmanager.cs
- UiaCoreProviderApi.cs
- serverconfig.cs
- BulletedListEventArgs.cs
- PhysicalFontFamily.cs
- FileDetails.cs
- DisplayInformation.cs
- ConnectionProviderAttribute.cs
- GrabHandleGlyph.cs
- WhitespaceSignificantCollectionAttribute.cs
- CredentialCache.cs
- _HelperAsyncResults.cs
- OleDbRowUpdatedEvent.cs
- Native.cs
- NativeMethods.cs
- StdValidatorsAndConverters.cs
- ExpanderAutomationPeer.cs
- EntityViewGenerationAttribute.cs
- InputLangChangeRequestEvent.cs
- NativeMethods.cs
- StoreItemCollection.cs
- TreeNodeEventArgs.cs
- Pair.cs
- DesignerDataColumn.cs
- HelpProvider.cs
- ColorKeyFrameCollection.cs
- ColumnResult.cs
- UrlMappingsModule.cs
- UpdatePanelTrigger.cs
- Logging.cs
- ReceiveCompletedEventArgs.cs
- FormClosedEvent.cs
- ContextMenu.cs
- DataBindEngine.cs
- DataGridViewCellMouseEventArgs.cs
- SystemNetHelpers.cs
- SplitterPanel.cs
- ArgumentNullException.cs
- SqlConnection.cs
- StreamWithDictionary.cs
- OdbcReferenceCollection.cs
- diagnosticsswitches.cs
- MatrixTransform3D.cs
- SamlSerializer.cs
- ControlPropertyNameConverter.cs
- AstTree.cs
- InputBinder.cs
- MDIControlStrip.cs
- DbConnectionPool.cs
- AppendHelper.cs
- CompilationSection.cs
- bidPrivateBase.cs
- SignatureToken.cs
- Relationship.cs
- DbProviderManifest.cs
- ColumnCollection.cs
- XmlnsDictionary.cs
- SHA512Cng.cs
- XmlSchemaInfo.cs
- QueryContinueDragEvent.cs
- FontSizeConverter.cs
- Metadata.cs
- DesignerHelpers.cs
- MimeFormImporter.cs
- MDIControlStrip.cs
- DoubleLinkListEnumerator.cs
- TransactionsSectionGroup.cs
- TraceXPathNavigator.cs
- PackagePartCollection.cs
- Cursors.cs
- QilPatternFactory.cs
- RelationshipDetailsCollection.cs
- AdornerDecorator.cs
- SourceItem.cs
- WebPartDescriptionCollection.cs
- _NtlmClient.cs
- WebPartDisplayModeEventArgs.cs
- ExpressionNormalizer.cs
- ShowExpandedMultiValueConverter.cs
- DisplayNameAttribute.cs
- GeneralTransformGroup.cs
- TypeResolver.cs