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
- ApplicationInfo.cs
- Bold.cs
- ListDictionary.cs
- AsyncOperation.cs
- cookieexception.cs
- SwitchElementsCollection.cs
- TextTreeDeleteContentUndoUnit.cs
- Wow64ConfigurationLoader.cs
- Stack.cs
- SimplePropertyEntry.cs
- StyleModeStack.cs
- SafeLibraryHandle.cs
- ClassHandlersStore.cs
- GridViewSortEventArgs.cs
- CodeTypeConstructor.cs
- safex509handles.cs
- BackgroundWorker.cs
- SystemNetworkInterface.cs
- EntityDesignerUtils.cs
- querybuilder.cs
- ButtonField.cs
- PanelStyle.cs
- _StreamFramer.cs
- BitmapFrameDecode.cs
- CommandExpr.cs
- RegistrySecurity.cs
- ToolStripItemClickedEventArgs.cs
- Int32AnimationBase.cs
- QueueProcessor.cs
- BufferedMessageData.cs
- ReadOnlyDictionary.cs
- TableItemProviderWrapper.cs
- ColumnCollection.cs
- ContextQuery.cs
- DocumentSequence.cs
- IdentityHolder.cs
- UriExt.cs
- WindowsTreeView.cs
- DWriteFactory.cs
- DbDataReader.cs
- _CookieModule.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ProfileSection.cs
- SystemInformation.cs
- CompositionCommandSet.cs
- PointKeyFrameCollection.cs
- ExtensionFile.cs
- LocalizableAttribute.cs
- ApplicationManager.cs
- FtpRequestCacheValidator.cs
- ServiceInstanceProvider.cs
- ElementAtQueryOperator.cs
- EntityStoreSchemaGenerator.cs
- SqlStatistics.cs
- CanonicalizationDriver.cs
- AlgoModule.cs
- MemoryPressure.cs
- FrameworkElementFactoryMarkupObject.cs
- PolicyStatement.cs
- X509CertificateCollection.cs
- BevelBitmapEffect.cs
- DataContractSerializerMessageContractImporter.cs
- CodeEventReferenceExpression.cs
- WmpBitmapDecoder.cs
- WindowsHyperlink.cs
- ActivatedMessageQueue.cs
- OdbcHandle.cs
- Bidi.cs
- XhtmlConformanceSection.cs
- UnaryOperationBinder.cs
- _FixedSizeReader.cs
- Terminate.cs
- DataGridColumnHeaderCollection.cs
- CacheHelper.cs
- TextSpanModifier.cs
- SqlClientWrapperSmiStream.cs
- ImportOptions.cs
- HtmlInputControl.cs
- Binding.cs
- SafeNativeMethods.cs
- EntityContainerEntitySetDefiningQuery.cs
- DrawingAttributeSerializer.cs
- ImageDesigner.cs
- ThousandthOfEmRealPoints.cs
- HttpStreamMessageEncoderFactory.cs
- WebBrowserContainer.cs
- IpcServerChannel.cs
- OdbcPermission.cs
- SkipQueryOptionExpression.cs
- QuotaThrottle.cs
- _AutoWebProxyScriptEngine.cs
- NativeMethods.cs
- DefaultAssemblyResolver.cs
- Converter.cs
- SqlPersistenceWorkflowInstanceDescription.cs
- ManualResetEvent.cs
- ImmComposition.cs
- ipaddressinformationcollection.cs
- ModelUtilities.cs
- AssertFilter.cs