Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Log / System / IO / Log / FileRecordSequenceCompletedAsyncResult.cs / 1305376 / FileRecordSequenceCompletedAsyncResult.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Diagnostics; using System.Runtime; 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 (Fx.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. //----------------------------------------------------------- namespace System.IO.Log { using System; using System.Diagnostics; using System.Runtime; 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 (Fx.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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FrameworkName.cs
- GorillaCodec.cs
- Config.cs
- CuspData.cs
- OracleDataReader.cs
- ThicknessAnimation.cs
- BinaryFormatterWriter.cs
- Monitor.cs
- sqlser.cs
- SrgsElement.cs
- DebugController.cs
- SqlDesignerDataSourceView.cs
- TransportSecurityHelpers.cs
- DataComponentMethodGenerator.cs
- XmlSchemaExporter.cs
- BitmapCodecInfoInternal.cs
- TypeUtil.cs
- WebConfigurationHostFileChange.cs
- UndoEngine.cs
- MemberCollection.cs
- JobPageOrder.cs
- ELinqQueryState.cs
- DesignerDataSchemaClass.cs
- StrongNameSignatureInformation.cs
- SelectorAutomationPeer.cs
- WebPartEditorCancelVerb.cs
- ManualResetEventSlim.cs
- StorageEntitySetMapping.cs
- QualificationDataAttribute.cs
- HtmlTextBoxAdapter.cs
- ConditionValidator.cs
- UrlPath.cs
- WebPartConnectionsDisconnectVerb.cs
- SynchronizationHandlesCodeDomSerializer.cs
- UIElementHelper.cs
- ContentPlaceHolder.cs
- UIElementParaClient.cs
- WindowsEditBox.cs
- DesignTimeParseData.cs
- QilUnary.cs
- AxHostDesigner.cs
- ScriptModule.cs
- LayoutTableCell.cs
- HttpCapabilitiesBase.cs
- TreeNodeBinding.cs
- MeshGeometry3D.cs
- ListBindableAttribute.cs
- SQLMoney.cs
- TabletDeviceInfo.cs
- HttpCookiesSection.cs
- WmlLabelAdapter.cs
- FrameworkObject.cs
- Compiler.cs
- HandleRef.cs
- ImplicitInputBrush.cs
- BuildProviderAppliesToAttribute.cs
- safex509handles.cs
- PageCodeDomTreeGenerator.cs
- SqlDataSourceStatusEventArgs.cs
- StateChangeEvent.cs
- XmlSignificantWhitespace.cs
- RuntimeWrappedException.cs
- DataConnectionHelper.cs
- EventSourceCreationData.cs
- ConfigurationValues.cs
- StructuredTypeInfo.cs
- SectionInput.cs
- _Win32.cs
- HtmlShim.cs
- TeredoHelper.cs
- TemplateControlParser.cs
- HierarchicalDataBoundControl.cs
- StreamUpdate.cs
- DataGridViewBindingCompleteEventArgs.cs
- TextEditorTyping.cs
- CharEntityEncoderFallback.cs
- ResourceAttributes.cs
- DataControlFieldCollection.cs
- TypeBinaryExpression.cs
- ComponentDispatcher.cs
- CollectionViewGroup.cs
- ConfigurationSectionHelper.cs
- RightsManagementInformation.cs
- AdornerLayer.cs
- WorkItem.cs
- FileLevelControlBuilderAttribute.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- MgmtResManager.cs
- FunctionImportElement.cs
- AuthorizationRule.cs
- WorkflowRuntimeSection.cs
- PlatformNotSupportedException.cs
- Button.cs
- DbParameterCollectionHelper.cs
- HostProtectionException.cs
- RenderingEventArgs.cs
- Polyline.cs
- PersistChildrenAttribute.cs
- Table.cs
- PageBreakRecord.cs