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
- RectConverter.cs
- OpacityConverter.cs
- DataControlLinkButton.cs
- GridItemPatternIdentifiers.cs
- OleDbDataAdapter.cs
- DropTarget.cs
- SwitchElementsCollection.cs
- DataPagerCommandEventArgs.cs
- EncoderParameter.cs
- CmsInterop.cs
- ProfileBuildProvider.cs
- XmlBinaryReader.cs
- DBPropSet.cs
- MulticastDelegate.cs
- FormViewDeleteEventArgs.cs
- SqlTypeConverter.cs
- WorkflowInstanceExtensionManager.cs
- ColumnBinding.cs
- IsolatedStorageFilePermission.cs
- DeferredReference.cs
- RequestSecurityTokenForRemoteTokenFactory.cs
- BaseResourcesBuildProvider.cs
- HttpResponseHeader.cs
- ObjectParameter.cs
- CharUnicodeInfo.cs
- HtmlInputHidden.cs
- PropertyCollection.cs
- Logging.cs
- DesignerSelectionListAdapter.cs
- TextEffectResolver.cs
- Timer.cs
- DataGridTextBoxColumn.cs
- InvalidOperationException.cs
- SiteMapHierarchicalDataSourceView.cs
- AssemblyInfo.cs
- SystemFonts.cs
- WebPartAddingEventArgs.cs
- DefaultValueAttribute.cs
- TypeUtils.cs
- EpmHelper.cs
- ParameterCollection.cs
- VisualBrush.cs
- XmlILStorageConverter.cs
- WebBrowserDesigner.cs
- Interop.cs
- WindowsAuthenticationEventArgs.cs
- FontCacheUtil.cs
- SafeCoTaskMem.cs
- ConnectionStringSettings.cs
- IntMinMaxAggregationOperator.cs
- ImageMapEventArgs.cs
- Html32TextWriter.cs
- MenuStrip.cs
- TransmissionStrategy.cs
- SizeAnimationBase.cs
- EntityDataSourceWrapper.cs
- SqlConnection.cs
- HttpCapabilitiesBase.cs
- RightsManagementResourceHelper.cs
- XmlCharType.cs
- DisableDpiAwarenessAttribute.cs
- FlowDocumentReaderAutomationPeer.cs
- CompositeActivityValidator.cs
- ImageInfo.cs
- Permission.cs
- ScriptBehaviorDescriptor.cs
- WebResponse.cs
- OleDbFactory.cs
- WSHttpBindingBaseElement.cs
- ObjectDataSourceMethodEventArgs.cs
- Tokenizer.cs
- WindowsFormsSynchronizationContext.cs
- EtwTrace.cs
- X509Chain.cs
- UnsafeNativeMethods.cs
- ScrollProviderWrapper.cs
- UriTemplateTable.cs
- InvalidWMPVersionException.cs
- HostedHttpTransportManager.cs
- XmlSchemaRedefine.cs
- DataGridViewComboBoxCell.cs
- PropertyEmitterBase.cs
- AssemblyAttributes.cs
- ActivityExecutor.cs
- XmlSchemaAppInfo.cs
- LinkGrep.cs
- _TimerThread.cs
- GridViewColumn.cs
- METAHEADER.cs
- listitem.cs
- ColorEditor.cs
- OdbcEnvironment.cs
- SchemaMapping.cs
- Baml2006Reader.cs
- Enum.cs
- AttachedAnnotation.cs
- DataGridViewButtonCell.cs
- ModelItemImpl.cs
- ParallelEnumerableWrapper.cs
- AmbientLight.cs