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
- HtmlInputRadioButton.cs
- PageCache.cs
- DataGridCell.cs
- DelegateBodyWriter.cs
- SQLCharsStorage.cs
- StylusPointProperty.cs
- CodeDomSerializationProvider.cs
- InvalidPropValue.cs
- _SslSessionsCache.cs
- MissingMemberException.cs
- RowBinding.cs
- BitmapEffectState.cs
- TextRunTypographyProperties.cs
- PolicyStatement.cs
- TreeNodeEventArgs.cs
- SHA256.cs
- StylusTip.cs
- ComponentResourceKey.cs
- XamlTypeMapperSchemaContext.cs
- XmlUTF8TextReader.cs
- StylusPlugInCollection.cs
- GenericUriParser.cs
- Panel.cs
- AppDomainEvidenceFactory.cs
- UIntPtr.cs
- InstanceHandleReference.cs
- ReadWriteObjectLock.cs
- TextDecorationUnitValidation.cs
- WeakReferenceList.cs
- RawStylusInputCustomDataList.cs
- MSAANativeProvider.cs
- AdapterUtil.cs
- SettingsSavedEventArgs.cs
- AssemblyAssociatedContentFileAttribute.cs
- EditorServiceContext.cs
- NavigatorInput.cs
- DirectoryNotFoundException.cs
- HttpHandlerActionCollection.cs
- NonSerializedAttribute.cs
- GeometryValueSerializer.cs
- Pen.cs
- ChangePassword.cs
- HtmlTableCellCollection.cs
- CmsUtils.cs
- ResXResourceSet.cs
- GridPattern.cs
- ResourceKey.cs
- Sequence.cs
- FontDriver.cs
- DateTimeSerializationSection.cs
- ListViewItemEventArgs.cs
- SqlServices.cs
- MenuItemBindingCollection.cs
- RuleEngine.cs
- Helpers.cs
- PagedDataSource.cs
- CqlGenerator.cs
- Focus.cs
- Menu.cs
- DelegateTypeInfo.cs
- TrustSection.cs
- infer.cs
- VersionValidator.cs
- ToolStripDropDownItem.cs
- Package.cs
- CurrentTimeZone.cs
- ThreadInterruptedException.cs
- ApplicationDirectoryMembershipCondition.cs
- QilParameter.cs
- Overlapped.cs
- MoveSizeWinEventHandler.cs
- BindingExpressionUncommonField.cs
- XappLauncher.cs
- MulticastNotSupportedException.cs
- Triplet.cs
- SystemKeyConverter.cs
- DataGridAddNewRow.cs
- Pens.cs
- DataRowCollection.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- Vector3dCollection.cs
- CssStyleCollection.cs
- ExceptionUtility.cs
- PerformanceCounter.cs
- XmlBinaryReader.cs
- TypeSystemProvider.cs
- SQLBinary.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- XmlValidatingReader.cs
- DiscriminatorMap.cs
- ScriptResourceAttribute.cs
- InternalConfigSettingsFactory.cs
- Figure.cs
- SQLInt32.cs
- Int32Converter.cs
- TraceSection.cs
- WebPartDisplayModeEventArgs.cs
- unsafenativemethodstextservices.cs
- RegexMatchCollection.cs
- Contracts.cs