Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Net / System / Net / Mail / MultiAsyncResult.cs / 1 / MultiAsyncResult.cs
namespace System.Net.Mime
{
using System;
internal class MultiAsyncResult : LazyAsyncResult
{
int outstanding;
object context;
internal MultiAsyncResult(object context, AsyncCallback callback, object state) : base(context,state,callback)
{
this.context = context;
}
internal object Context
{
get
{
return this.context;
}
}
internal void Enter()
{
Increment();
}
internal void Leave()
{
Decrement();
}
internal void Leave(object result)
{
this.Result = result;
Decrement();
}
void Decrement()
{
if (System.Threading.Interlocked.Decrement(ref this.outstanding) == -1)
{
base.InvokeCallback(Result);
}
}
void Increment()
{
System.Threading.Interlocked.Increment(ref this.outstanding);
}
internal void CompleteSequence()
{
Decrement();
}
internal static object End(IAsyncResult result)
{
MultiAsyncResult thisPtr = (MultiAsyncResult)result;
thisPtr.InternalWaitForCompletion();
return thisPtr.Result;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace System.Net.Mime
{
using System;
internal class MultiAsyncResult : LazyAsyncResult
{
int outstanding;
object context;
internal MultiAsyncResult(object context, AsyncCallback callback, object state) : base(context,state,callback)
{
this.context = context;
}
internal object Context
{
get
{
return this.context;
}
}
internal void Enter()
{
Increment();
}
internal void Leave()
{
Decrement();
}
internal void Leave(object result)
{
this.Result = result;
Decrement();
}
void Decrement()
{
if (System.Threading.Interlocked.Decrement(ref this.outstanding) == -1)
{
base.InvokeCallback(Result);
}
}
void Increment()
{
System.Threading.Interlocked.Increment(ref this.outstanding);
}
internal void CompleteSequence()
{
Decrement();
}
internal static object End(IAsyncResult result)
{
MultiAsyncResult thisPtr = (MultiAsyncResult)result;
thisPtr.InternalWaitForCompletion();
return thisPtr.Result;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ProgressBarHighlightConverter.cs
- ListControl.cs
- ProxyManager.cs
- OleDbCommandBuilder.cs
- PostBackTrigger.cs
- HTMLTextWriter.cs
- ListBoxItemWrapperAutomationPeer.cs
- XmlSchemaElement.cs
- EmbeddedMailObjectsCollection.cs
- UserControlBuildProvider.cs
- InstanceDescriptor.cs
- RemoteWebConfigurationHost.cs
- InputLanguage.cs
- RangeValidator.cs
- ConnectionPoint.cs
- Wildcard.cs
- RoleService.cs
- ApplicationInfo.cs
- ServiceMetadataPublishingElement.cs
- SectionXmlInfo.cs
- BaseInfoTable.cs
- ImageCodecInfoPrivate.cs
- Hex.cs
- TextMarkerSource.cs
- AcceptorSessionSymmetricTransportSecurityProtocol.cs
- TypeConverterValueSerializer.cs
- CompModSwitches.cs
- CodeTypeConstructor.cs
- RoleGroup.cs
- XmlSchemaDatatype.cs
- xmlfixedPageInfo.cs
- HttpListenerException.cs
- XPathNodeInfoAtom.cs
- PrinterUnitConvert.cs
- ActivityMarkupSerializer.cs
- CompoundFileReference.cs
- SQLGuidStorage.cs
- QuaternionRotation3D.cs
- UriWriter.cs
- Clause.cs
- SuppressMessageAttribute.cs
- CodeMethodReturnStatement.cs
- ArrayElementGridEntry.cs
- HeaderUtility.cs
- FontSource.cs
- VariableExpressionConverter.cs
- DefaultObjectMappingItemCollection.cs
- FrameworkElementAutomationPeer.cs
- SamlAttributeStatement.cs
- RegionData.cs
- WebPartConnectionsEventArgs.cs
- NamespaceList.cs
- NestedContainer.cs
- TextAdaptor.cs
- BidOverLoads.cs
- InstallerTypeAttribute.cs
- TypeDelegator.cs
- FixedHighlight.cs
- ErrorWebPart.cs
- CustomError.cs
- CommandBinding.cs
- SafeHandles.cs
- ExpressionEditorAttribute.cs
- Int32.cs
- EventRouteFactory.cs
- ArithmeticException.cs
- HitTestParameters.cs
- DebugView.cs
- FunctionMappingTranslator.cs
- CurrentChangedEventManager.cs
- NextPreviousPagerField.cs
- TranslateTransform.cs
- QilTernary.cs
- mda.cs
- SqlBuilder.cs
- GeneralTransform.cs
- DataGridBoolColumn.cs
- UniqueID.cs
- HandleTable.cs
- XmlElementAttributes.cs
- TemplateComponentConnector.cs
- StringTraceRecord.cs
- ByteStreamMessage.cs
- ImageIndexConverter.cs
- Logging.cs
- BaseDataListComponentEditor.cs
- BinaryVersion.cs
- ClientFormsIdentity.cs
- PropertyTabAttribute.cs
- QueryResponse.cs
- Stack.cs
- FieldNameLookup.cs
- ContentHostHelper.cs
- DbDataSourceEnumerator.cs
- PieceNameHelper.cs
- StdValidatorsAndConverters.cs
- CollectionViewProxy.cs
- XmlSchemaDocumentation.cs
- CacheEntry.cs
- TrackingStringDictionary.cs