Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / TransactionBridge / Microsoft / Transactions / Wsat / Messaging / ReferenceCountedObject.cs / 1 / ReferenceCountedObject.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- using System; using System.Threading; using DiagnosticUtility = Microsoft.Transactions.Bridge.DiagnosticUtility; namespace Microsoft.Transactions.Wsat.Messaging { abstract class ReferenceCountedObject { int refCount = 1; public void AddRef() { int refs = Interlocked.Increment(ref this.refCount); if (refs <= 0) { // Reference counting bug was detected. // This means that the code is buggy and needs to be fixed. DiagnosticUtility.FailFast("Reference count below 0"); } } public void Release() { int refs = Interlocked.Decrement(ref this.refCount); if (refs < 0) { // Reference counting bug was detected. // This means that the code is buggy and needs to be fixed. DiagnosticUtility.FailFast("Reference count below 0"); } if (refs == 0) Close(); } protected abstract void Close(); } } // 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
- Content.cs
- ConfigurationProperty.cs
- Delegate.cs
- BaseDataBoundControlDesigner.cs
- BitmapEffectInput.cs
- ArrangedElementCollection.cs
- TypeConverterHelper.cs
- Panel.cs
- WebServiceEnumData.cs
- ExpressionBuilderCollection.cs
- CheckedListBox.cs
- WmpBitmapEncoder.cs
- oledbmetadatacollectionnames.cs
- ElementInit.cs
- __Filters.cs
- GeometryValueSerializer.cs
- WebBaseEventKeyComparer.cs
- SettingsPropertyCollection.cs
- GridItemPatternIdentifiers.cs
- BinaryFormatter.cs
- EntityDescriptor.cs
- DesignOnlyAttribute.cs
- ExpandCollapseProviderWrapper.cs
- BufferedResponseStream.cs
- AdCreatedEventArgs.cs
- SqlDependencyListener.cs
- _SpnDictionary.cs
- HandleTable.cs
- TextFormatterHost.cs
- TranslateTransform.cs
- LambdaCompiler.Unary.cs
- TemplateControlParser.cs
- DependencyObjectProvider.cs
- WebPartsPersonalizationAuthorization.cs
- SoapTypeAttribute.cs
- WebDisplayNameAttribute.cs
- StorageComplexTypeMapping.cs
- DateBoldEvent.cs
- GifBitmapEncoder.cs
- WorkflowMarkupSerializer.cs
- DesignerActionService.cs
- PasswordRecovery.cs
- XmlDocument.cs
- MulticastNotSupportedException.cs
- TypeConverter.cs
- TableChangeProcessor.cs
- DeflateStream.cs
- PersonalizationState.cs
- HotSpot.cs
- BasicViewGenerator.cs
- EncryptRequest.cs
- HttpUnhandledOperationInvoker.cs
- JoinElimination.cs
- ComboBoxAutomationPeer.cs
- StateItem.cs
- ImageList.cs
- ComponentTray.cs
- NumericUpDownAcceleration.cs
- DataSourceCacheDurationConverter.cs
- DefaultAutoFieldGenerator.cs
- RtfControls.cs
- UInt16Storage.cs
- coordinatorfactory.cs
- ProcessModuleDesigner.cs
- VideoDrawing.cs
- PassportIdentity.cs
- ComPlusTypeValidator.cs
- PhonemeEventArgs.cs
- MouseBinding.cs
- XmlArrayItemAttribute.cs
- ResourceManager.cs
- SQLByteStorage.cs
- Encoder.cs
- OpCellTreeNode.cs
- ExpressionNormalizer.cs
- InvokeBase.cs
- TextChange.cs
- Processor.cs
- WebConfigurationHostFileChange.cs
- MergablePropertyAttribute.cs
- HtmlMeta.cs
- ErrorFormatterPage.cs
- CommonProperties.cs
- ExtentCqlBlock.cs
- ColorConverter.cs
- CatchBlock.cs
- XNodeValidator.cs
- ToolStripDropDownClosingEventArgs.cs
- RecordManager.cs
- VectorAnimationBase.cs
- WorkflowRuntime.cs
- BooleanToVisibilityConverter.cs
- XhtmlConformanceSection.cs
- WhileDesigner.xaml.cs
- XPathAncestorIterator.cs
- PropertyPushdownHelper.cs
- CompensationParticipant.cs
- XPathNavigator.cs
- TextProperties.cs
- WindowsGraphics2.cs