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
- ToolStripDesignerUtils.cs
- DataPager.cs
- BaseServiceProvider.cs
- ThousandthOfEmRealDoubles.cs
- PropertyToken.cs
- datacache.cs
- WebSysDescriptionAttribute.cs
- QueryOutputWriter.cs
- _NegoState.cs
- DbParameterCollectionHelper.cs
- DataSourceCacheDurationConverter.cs
- Menu.cs
- DateTime.cs
- SingleConverter.cs
- DataGridViewCellStyle.cs
- Attributes.cs
- ObjectListFieldCollection.cs
- Stack.cs
- UpdatePanelControlTrigger.cs
- BinaryNode.cs
- ValueChangedEventManager.cs
- AncestorChangedEventArgs.cs
- RelationshipDetailsRow.cs
- UrlMapping.cs
- Win32MouseDevice.cs
- Site.cs
- AnnotationComponentChooser.cs
- ToolBarButtonClickEvent.cs
- XmlSignificantWhitespace.cs
- DetailsViewRow.cs
- DbFunctionCommandTree.cs
- ToolStripDropDownItem.cs
- ContentTextAutomationPeer.cs
- ClientTargetCollection.cs
- SynchronizedDispatch.cs
- TypeRestriction.cs
- FileLoadException.cs
- IconConverter.cs
- CategoryGridEntry.cs
- RankException.cs
- UnaryNode.cs
- LocalIdKeyIdentifierClause.cs
- DataGridTextBox.cs
- OciLobLocator.cs
- MetadataProperty.cs
- SqlProvider.cs
- ProfileSection.cs
- Rect.cs
- CompositionTarget.cs
- BlockUIContainer.cs
- ComponentDispatcherThread.cs
- ComponentConverter.cs
- ListParaClient.cs
- GcSettings.cs
- EndOfStreamException.cs
- XmlCharCheckingReader.cs
- ServerIdentity.cs
- RegexCaptureCollection.cs
- TreeView.cs
- RoutedEventConverter.cs
- IssuanceLicense.cs
- XmlStreamNodeWriter.cs
- WebPartZone.cs
- DataServiceContext.cs
- ObjectDataSourceSelectingEventArgs.cs
- DBAsyncResult.cs
- TextEditorSelection.cs
- MimeFormatExtensions.cs
- ObjectContextServiceProvider.cs
- RightsManagementUser.cs
- ObfuscationAttribute.cs
- TraversalRequest.cs
- OracleTimeSpan.cs
- UInt32Storage.cs
- PostBackOptions.cs
- DataBoundControlParameterTarget.cs
- FieldAccessException.cs
- HwndAppCommandInputProvider.cs
- Quaternion.cs
- safePerfProviderHandle.cs
- DbConnectionInternal.cs
- WebPartDescription.cs
- DecoderReplacementFallback.cs
- ContactManager.cs
- ExtentCqlBlock.cs
- Button.cs
- AppDomain.cs
- XmlCharType.cs
- ArraySortHelper.cs
- EditorBrowsableAttribute.cs
- Control.cs
- PrePrepareMethodAttribute.cs
- BrowsableAttribute.cs
- RuleConditionDialog.cs
- Duration.cs
- CryptoHandle.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- DbConnectionFactory.cs
- EntityCommandExecutionException.cs
- SHA384Managed.cs