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
- SimpleHandlerFactory.cs
- CodeNamespaceImport.cs
- ExpressionList.cs
- safesecurityhelperavalon.cs
- EventMappingSettings.cs
- HttpCookiesSection.cs
- PasswordPropertyTextAttribute.cs
- TemplatedMailWebEventProvider.cs
- X509Extension.cs
- RelationshipNavigation.cs
- SecurityTokenProvider.cs
- ForeignConstraint.cs
- TypeElementCollection.cs
- HTMLTagNameToTypeMapper.cs
- Serializer.cs
- NetSectionGroup.cs
- NativeMethods.cs
- DetailsViewModeEventArgs.cs
- ISFTagAndGuidCache.cs
- XPathExpr.cs
- ToolStripLabel.cs
- NonSerializedAttribute.cs
- RefExpr.cs
- BamlBinaryReader.cs
- SendSecurityHeader.cs
- ActivityBindForm.Designer.cs
- WebBrowser.cs
- BeginEvent.cs
- AlternateViewCollection.cs
- KerberosSecurityTokenAuthenticator.cs
- DataRelationPropertyDescriptor.cs
- XpsFontSerializationService.cs
- FixUpCollection.cs
- CatalogPartChrome.cs
- NetStream.cs
- XmlIlGenerator.cs
- HMACSHA1.cs
- UnsafeNativeMethods.cs
- DefaultSection.cs
- ListItemCollection.cs
- DesignerActionMethodItem.cs
- MessageDecoder.cs
- IsolatedStorageFile.cs
- CodeAttributeArgumentCollection.cs
- ListDesigner.cs
- KeyInterop.cs
- CustomError.cs
- FormsAuthenticationTicket.cs
- HiddenField.cs
- InfoCardKeyedHashAlgorithm.cs
- SettingsPropertyValue.cs
- FileLevelControlBuilderAttribute.cs
- MetricEntry.cs
- SqlDataSourceCommandEventArgs.cs
- CacheDict.cs
- StringValidatorAttribute.cs
- WebControl.cs
- LinearKeyFrames.cs
- ExponentialEase.cs
- RelationshipFixer.cs
- XmlSchemaObjectCollection.cs
- XmlSchemaValidator.cs
- AuthenticationServiceManager.cs
- ClientConfigurationSystem.cs
- AuthenticatingEventArgs.cs
- DataStreams.cs
- SizeKeyFrameCollection.cs
- SeekStoryboard.cs
- DataSourceControlBuilder.cs
- RMPublishingDialog.cs
- PermissionAttributes.cs
- XPathAncestorQuery.cs
- _HelperAsyncResults.cs
- HttpHandlerAction.cs
- ExecutionContext.cs
- TeredoHelper.cs
- StreamingContext.cs
- HealthMonitoringSection.cs
- SqlClientFactory.cs
- XmlSchemaFacet.cs
- SamlConstants.cs
- SourceFileInfo.cs
- WindowsToolbarItemAsMenuItem.cs
- SafeLibraryHandle.cs
- CapabilitiesSection.cs
- SID.cs
- TabRenderer.cs
- SHA512Managed.cs
- KeyboardNavigation.cs
- JsonReader.cs
- Serializer.cs
- EventBookmark.cs
- CompModSwitches.cs
- XmlSerializer.cs
- DynamicHyperLink.cs
- ImageListStreamer.cs
- DNS.cs
- XmlSchemaImport.cs
- MultipartContentParser.cs
- SerTrace.cs