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
- PenCursorManager.cs
- XamlToRtfParser.cs
- Double.cs
- DetailsViewInsertedEventArgs.cs
- CqlWriter.cs
- InkCollectionBehavior.cs
- EmptyWorkItem.cs
- Types.cs
- TransactedBatchingBehavior.cs
- SemanticKeyElement.cs
- SchemaTableOptionalColumn.cs
- OdbcEnvironment.cs
- ObjectAnimationBase.cs
- DbFunctionCommandTree.cs
- PingReply.cs
- OdbcCommand.cs
- OrderPreservingPipeliningMergeHelper.cs
- DbProviderSpecificTypePropertyAttribute.cs
- InkCanvasSelection.cs
- XpsResourceDictionary.cs
- XmlQueryOutput.cs
- DataGridViewColumnCollection.cs
- Certificate.cs
- EDesignUtil.cs
- ColumnTypeConverter.cs
- IODescriptionAttribute.cs
- GlyphsSerializer.cs
- StylusPointPropertyInfoDefaults.cs
- TraceXPathNavigator.cs
- MediaElementAutomationPeer.cs
- IdleTimeoutMonitor.cs
- GatewayDefinition.cs
- PropertyChangedEventManager.cs
- CodeMemberMethod.cs
- PeerCredential.cs
- AspCompat.cs
- XmlSchemaObjectTable.cs
- FileVersionInfo.cs
- CustomLineCap.cs
- EndPoint.cs
- TextEditorParagraphs.cs
- TableLayoutColumnStyleCollection.cs
- GcHandle.cs
- AssemblyNameProxy.cs
- AxParameterData.cs
- ForwardPositionQuery.cs
- NativeMethods.cs
- TabControlEvent.cs
- ListBoxItem.cs
- CertificateManager.cs
- SettingsPropertyNotFoundException.cs
- shaperfactoryquerycachekey.cs
- XmlSchemaProviderAttribute.cs
- QuaternionRotation3D.cs
- UseLicense.cs
- RemotingException.cs
- TabControl.cs
- SocketElement.cs
- RowType.cs
- WebPartUserCapability.cs
- AssemblyBuilder.cs
- XamlFxTrace.cs
- MasterPageCodeDomTreeGenerator.cs
- CachedBitmap.cs
- QueryOperationResponseOfT.cs
- SuppressMessageAttribute.cs
- InvalidComObjectException.cs
- SQLByte.cs
- GlyphsSerializer.cs
- webclient.cs
- ColumnHeaderConverter.cs
- HitTestParameters3D.cs
- Attribute.cs
- CachedFontFace.cs
- ButtonStandardAdapter.cs
- ObjectView.cs
- NavigationProperty.cs
- WebFaultException.cs
- SystemParameters.cs
- LayoutDump.cs
- AuthenticationManager.cs
- FixedTextBuilder.cs
- WinFormsComponentEditor.cs
- AspCompat.cs
- SimpleLine.cs
- SourceFileBuildProvider.cs
- XmlFormatExtensionPointAttribute.cs
- InvokeGenerator.cs
- HttpListenerContext.cs
- TreeViewBindingsEditorForm.cs
- Pens.cs
- ApplicationSecurityInfo.cs
- ProxyWebPartManager.cs
- InternalCache.cs
- SqlBuilder.cs
- MenuItemBindingCollection.cs
- MessageQueueAccessControlEntry.cs
- BinHexEncoder.cs
- TreeView.cs
- CodeTypeReference.cs