Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Log / System / IO / Log / FileRecordSequenceCompletedAsyncResult.cs / 1 / FileRecordSequenceCompletedAsyncResult.cs
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------
namespace System.IO.Log
{
using System;
using System.Diagnostics;
using System.Threading;
enum Work
{
Append,
Flush,
ReserveAndAppend,
WriteRestartArea
}
sealed class FileRecordSequenceCompletedAsyncResult : IAsyncResult
{
SequenceNumber result;
object userState;
AsyncCallback callback;
bool endCalled;
Work work;
object syncRoot;
ManualResetEvent waitHandle;
public FileRecordSequenceCompletedAsyncResult(
SequenceNumber result,
AsyncCallback callback,
object userState,
Work work)
{
this.result = result;
this.callback = callback;
this.userState = userState;
this.work = work;
this.syncRoot = new object();
if (this.callback != null)
{
try
{
this.callback(this);
}
#pragma warning suppress 56500 // This is a callback exception
catch(Exception e)
{
if (DiagnosticUtility.IsFatal(e))
throw;
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(e);
}
}
}
public Object AsyncState
{
get { return this.userState; }
}
public WaitHandle AsyncWaitHandle
{
get
{
lock(this.syncRoot)
{
// We won't ever close it (it must be GC'd instead), but try
// not to be too excessive in allocations.
//
if (this.waitHandle == null)
this.waitHandle = new ManualResetEvent(true);
}
return this.waitHandle;
}
}
public bool CompletedSynchronously
{
get { return true; }
}
public Work CompletedWork
{
get { return this.work; }
}
public bool IsCompleted
{
get { return true; }
}
internal SequenceNumber End()
{
if (this.endCalled)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.DuplicateEnd());
}
this.endCalled = true;
return this.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
- XmlResolver.cs
- MULTI_QI.cs
- HelpInfo.cs
- TranslateTransform.cs
- HtmlTableCellCollection.cs
- IPAddressCollection.cs
- ReadOnlyTernaryTree.cs
- InheritanceRules.cs
- ContractComponent.cs
- ContextBase.cs
- DynamicILGenerator.cs
- EntityDataSourceQueryBuilder.cs
- SmtpNetworkElement.cs
- TimelineGroup.cs
- SystemIPv4InterfaceProperties.cs
- ToolStripItemCollection.cs
- ClientApiGenerator.cs
- ObjectQuery_EntitySqlExtensions.cs
- Debug.cs
- COM2ColorConverter.cs
- SafeProcessHandle.cs
- TdsParserHelperClasses.cs
- FixedSOMTextRun.cs
- UrlAuthorizationModule.cs
- DecodeHelper.cs
- SystemWebCachingSectionGroup.cs
- ObjectCloneHelper.cs
- ElementHostPropertyMap.cs
- ErrorActivity.cs
- WebProxyScriptElement.cs
- CodeValidator.cs
- XsltLibrary.cs
- DataGridViewLayoutData.cs
- PolicyStatement.cs
- PolyBezierSegment.cs
- AutoScrollExpandMessageFilter.cs
- ContainerControlDesigner.cs
- TextEmbeddedObject.cs
- ActivityDesignerResources.cs
- ContentIterators.cs
- XslAst.cs
- RelationshipEndCollection.cs
- DataGridViewRowStateChangedEventArgs.cs
- TdsEnums.cs
- TraceHandlerErrorFormatter.cs
- TcpAppDomainProtocolHandler.cs
- ImportContext.cs
- ThreadSafeList.cs
- ToolStripItemTextRenderEventArgs.cs
- ScriptingSectionGroup.cs
- FaultContext.cs
- XmlTextWriter.cs
- TimeSpanSecondsConverter.cs
- ZoneLinkButton.cs
- RoutedCommand.cs
- TransformGroup.cs
- BaseParser.cs
- MembershipValidatePasswordEventArgs.cs
- SynchronizationHandlesCodeDomSerializer.cs
- CardSpaceSelector.cs
- MonthChangedEventArgs.cs
- SqlDataSourceQuery.cs
- ProtocolImporter.cs
- PointCollection.cs
- TreeViewImageIndexConverter.cs
- ScriptHandlerFactory.cs
- Image.cs
- IssuedTokenServiceCredential.cs
- DataTableClearEvent.cs
- XmlMemberMapping.cs
- LinkTarget.cs
- WindowsTitleBar.cs
- ComponentDispatcherThread.cs
- CommunicationObjectAbortedException.cs
- SHA1.cs
- DateTimeUtil.cs
- ConfigurationStrings.cs
- TemplateControlParser.cs
- AudioDeviceOut.cs
- RangeValuePattern.cs
- TypeInfo.cs
- DataBinding.cs
- ColorTranslator.cs
- DependencyObject.cs
- CaseStatement.cs
- NativeCppClassAttribute.cs
- QueryHandler.cs
- StringConverter.cs
- WebEventCodes.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- TemplateEditingService.cs
- DiagnosticsConfigurationHandler.cs
- InvalidPrinterException.cs
- LogWriteRestartAreaState.cs
- BuildProvider.cs
- XmlQueryTypeFactory.cs
- WebRequest.cs
- ToolStripSplitStackLayout.cs
- SqlInternalConnectionSmi.cs
- LocatorManager.cs