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
- LockedBorderGlyph.cs
- BitHelper.cs
- GenericEnumerator.cs
- DataBoundControl.cs
- M3DUtil.cs
- XComponentModel.cs
- MarkupProperty.cs
- InvalidPropValue.cs
- CodeDelegateInvokeExpression.cs
- WebBrowsableAttribute.cs
- WebPageTraceListener.cs
- Attribute.cs
- ImageFormat.cs
- GridViewSortEventArgs.cs
- WindowsGraphics.cs
- DataBindingCollectionEditor.cs
- ServerValidateEventArgs.cs
- VerificationAttribute.cs
- AppDomainUnloadedException.cs
- UnsafeNativeMethods.cs
- ADMembershipUser.cs
- odbcmetadatacolumnnames.cs
- DesignerMetadata.cs
- WriteTimeStream.cs
- ServiceEndpointAssociationProvider.cs
- AppDomainFactory.cs
- IncrementalHitTester.cs
- PropertyBuilder.cs
- EventHandlingScope.cs
- SpeechSynthesizer.cs
- OrCondition.cs
- XPathItem.cs
- X509Extension.cs
- RichTextBoxConstants.cs
- UnionExpr.cs
- ComponentSerializationService.cs
- UIElementParagraph.cs
- ToolStrip.cs
- ExcludePathInfo.cs
- Size3D.cs
- RadialGradientBrush.cs
- Button.cs
- _TimerThread.cs
- TextRunCacheImp.cs
- StorageFunctionMapping.cs
- ReferencedCollectionType.cs
- HtmlGenericControl.cs
- ProcessHostMapPath.cs
- CodeTypeReferenceExpression.cs
- EntityDataSourceValidationException.cs
- StoryFragments.cs
- ListSourceHelper.cs
- VectorAnimation.cs
- LocalizationCodeDomSerializer.cs
- AdjustableArrowCap.cs
- EmptyControlCollection.cs
- SchemaCollectionCompiler.cs
- DefaultCommandExtensionCallback.cs
- XmlReflectionImporter.cs
- PersonalizationProviderHelper.cs
- PngBitmapDecoder.cs
- DecimalAnimationUsingKeyFrames.cs
- ListViewItemSelectionChangedEvent.cs
- PersonalizationStateInfoCollection.cs
- LoadedOrUnloadedOperation.cs
- UpdatePanelControlTrigger.cs
- RuleSetDialog.cs
- ScrollProviderWrapper.cs
- ServiceEndpointAssociationProvider.cs
- ElapsedEventArgs.cs
- HtmlTableCellCollection.cs
- AssociationTypeEmitter.cs
- CqlLexer.cs
- BuildTopDownAttribute.cs
- InkCanvasInnerCanvas.cs
- ScopelessEnumAttribute.cs
- PreparingEnlistment.cs
- QilExpression.cs
- MessageFault.cs
- RoleGroupCollection.cs
- SiteMapDataSource.cs
- NetworkInformationPermission.cs
- HostingPreferredMapPath.cs
- FileDialog_Vista_Interop.cs
- ToolStripDropTargetManager.cs
- VerificationException.cs
- SimpleType.cs
- peernodeimplementation.cs
- WindowsScroll.cs
- MobileCategoryAttribute.cs
- GcHandle.cs
- EdmPropertyAttribute.cs
- FormViewDeleteEventArgs.cs
- FrameAutomationPeer.cs
- ComboBox.cs
- Simplifier.cs
- SourceSwitch.cs
- RoutingConfiguration.cs
- FixedPosition.cs
- HttpCacheVaryByContentEncodings.cs