Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Log / System / IO / Log / LogFlushAsyncResult.cs / 1 / LogFlushAsyncResult.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IO.Log { using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Security.Permissions; using System.Threading; using Microsoft.Win32.SafeHandles; sealed class LogFlushAsyncResult : OverlappedAsyncResult { LogRecordSequence recordSequence; ulong sequenceNumber; object boxedResultLsn; GCHandle pinnedResultLsn; internal LogFlushAsyncResult(LogRecordSequence recordSequence, AsyncCallback callback, object state) : base(callback, state) { this.recordSequence = recordSequence; } //=========================================================== // Parameters //=========================================================== internal ulong SequenceNumber { /* get { return this.sequenceNumber; } */ set { this.sequenceNumber = value; } } //============================================================ // Result //=========================================================== internal ulong ResultLsn { get { return (ulong)this.boxedResultLsn; } } internal void Start() { try { ulong resultLsn = 0; this.boxedResultLsn = (object)(resultLsn); this.pinnedResultLsn = GCHandle.Alloc(this.boxedResultLsn, GCHandleType.Pinned); Pack(this.boxedResultLsn); uint errorCode; unsafe { errorCode = UnsafeNativeMethods.FlushLogToLsnAsync( this.recordSequence.MarshalContext, ref this.sequenceNumber, this.pinnedResultLsn.AddrOfPinnedObject(), this.NativeOverlapped); } if (errorCode != Error.ERROR_IO_PENDING) { // We don't need to call Free() in a finally block, // because any exception will failfast the process Free(); this.pinnedResultLsn.Free(); if (errorCode == Error.ERROR_SUCCESS) { Complete(true, null); } else { Complete( true, UnsafeNativeMethods.FlushLogToLsnFilter(errorCode)); } } } #pragma warning suppress 56500 // We will be terminating the process with any exception in this call catch(Exception e) { // The code in the try block should not throw any exceptions. // If an exception is caught here, IO.Log may be in an unknown state. // We prefer to failfast instead of risking the possibility of log corruption. // Any client code using IO.Log must have a recovery model that can deal // with appdomain and process failures. DiagnosticUtility.InvokeFinalHandler(e); } } internal override void IOCompleted(uint errorCode) { this.pinnedResultLsn.Free(); if (errorCode == Error.ERROR_SUCCESS) { Complete(false, null); } else { Complete(false, UnsafeNativeMethods.FlushLogToLsnFilter(errorCode)); } } } } // 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
- ProfileServiceManager.cs
- Command.cs
- ItemCollection.cs
- SurrogateEncoder.cs
- util.cs
- Container.cs
- RoleExceptions.cs
- QueuedDeliveryRequirementsMode.cs
- LocatorBase.cs
- XmlStringTable.cs
- ActionFrame.cs
- SQLDouble.cs
- FileUpload.cs
- InfoCardSymmetricCrypto.cs
- WebPartActionVerb.cs
- DispatcherEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- CategoryNameCollection.cs
- LoginCancelEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- RotateTransform3D.cs
- XhtmlBasicObjectListAdapter.cs
- SmiEventSink_DeferedProcessing.cs
- GlobalizationAssembly.cs
- XPathBinder.cs
- Trace.cs
- TypeElement.cs
- WsdlImporterElement.cs
- PackagePart.cs
- WebPartConnectVerb.cs
- InkCanvasInnerCanvas.cs
- ProcessHostFactoryHelper.cs
- ComponentCommands.cs
- SignatureHelper.cs
- CoTaskMemHandle.cs
- ScriptRegistrationManager.cs
- PathFigureCollectionConverter.cs
- PersonalizationStateQuery.cs
- DataPager.cs
- UntrustedRecipientException.cs
- ColorInterpolationModeValidation.cs
- DSASignatureDeformatter.cs
- WindowsContainer.cs
- DrawItemEvent.cs
- IncrementalHitTester.cs
- TreeWalkHelper.cs
- SimpleBitVector32.cs
- DrawingBrush.cs
- Hashtable.cs
- TargetPerspective.cs
- WebServiceClientProxyGenerator.cs
- _ConnectionGroup.cs
- PlaceHolder.cs
- RepeatBehavior.cs
- DbDataSourceEnumerator.cs
- TextHidden.cs
- GC.cs
- Point3DConverter.cs
- PropertyGrid.cs
- AppDomainManager.cs
- MatchingStyle.cs
- Psha1DerivedKeyGeneratorHelper.cs
- RoutedPropertyChangedEventArgs.cs
- TableLayoutSettings.cs
- SeekStoryboard.cs
- OracleRowUpdatingEventArgs.cs
- SettingsSection.cs
- LicenseException.cs
- SimpleBitVector32.cs
- XmlSchemaGroup.cs
- ContextStaticAttribute.cs
- SoapClientProtocol.cs
- StorageEndPropertyMapping.cs
- ControlIdConverter.cs
- TypeDescriptorFilterService.cs
- DbSetClause.cs
- DrawingDrawingContext.cs
- ComponentFactoryHelpers.cs
- LinearKeyFrames.cs
- RuleCache.cs
- HttpHandlerAction.cs
- LayoutUtils.cs
- DbParameterHelper.cs
- DynamicResourceExtension.cs
- SerialReceived.cs
- TableCellAutomationPeer.cs
- WsdlBuildProvider.cs
- VarInfo.cs
- PathFigureCollection.cs
- Solver.cs
- SpecularMaterial.cs
- Parameter.cs
- XPathItem.cs
- ActivityWithResult.cs
- Transform3DCollection.cs
- InputBinding.cs
- TcpConnectionPoolSettings.cs
- HatchBrush.cs
- XmlObjectSerializerReadContext.cs
- CryptoConfig.cs