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
- HttpCachePolicyElement.cs
- UserPreferenceChangedEventArgs.cs
- InvalidDataContractException.cs
- IndicShape.cs
- PathFigureCollectionValueSerializer.cs
- FamilyCollection.cs
- GroupQuery.cs
- HtmlInputRadioButton.cs
- System.Data.OracleClient_BID.cs
- ToolboxComponentsCreatingEventArgs.cs
- DataGridViewEditingControlShowingEventArgs.cs
- Image.cs
- CaseInsensitiveComparer.cs
- SplineKeyFrames.cs
- DateTimeFormatInfo.cs
- WpfKnownMember.cs
- UserUseLicenseDictionaryLoader.cs
- HwndStylusInputProvider.cs
- Component.cs
- XmlAnyElementAttributes.cs
- ScriptDescriptor.cs
- DBCommandBuilder.cs
- PerspectiveCamera.cs
- ListBindableAttribute.cs
- HelpPage.cs
- EUCJPEncoding.cs
- TypeInfo.cs
- RenderCapability.cs
- QuaternionAnimation.cs
- FillErrorEventArgs.cs
- ConnectivityStatus.cs
- MarginsConverter.cs
- SelectionHighlightInfo.cs
- UrlMappingsModule.cs
- Int32Collection.cs
- PeerCollaborationPermission.cs
- SystemResources.cs
- ConfigPathUtility.cs
- XmlSignatureManifest.cs
- ImmComposition.cs
- SelectionBorderGlyph.cs
- ZipIOCentralDirectoryFileHeader.cs
- ErrorLog.cs
- AuthenticatedStream.cs
- ReachDocumentSequenceSerializer.cs
- ProfileSettingsCollection.cs
- HttpAsyncResult.cs
- BasicExpandProvider.cs
- DictionarySectionHandler.cs
- EmptyQuery.cs
- SelfSignedCertificate.cs
- SymmetricKeyWrap.cs
- MultiBinding.cs
- BlobPersonalizationState.cs
- ToolStripSplitStackLayout.cs
- InputScope.cs
- RequestCacheValidator.cs
- ObservableCollection.cs
- DesignTimeParseData.cs
- SqlCommandSet.cs
- TypeSource.cs
- AuthenticationService.cs
- BaseDataBoundControl.cs
- ResourceManager.cs
- Application.cs
- XmlReflectionImporter.cs
- SplitterCancelEvent.cs
- TaiwanCalendar.cs
- errorpatternmatcher.cs
- ProcessThread.cs
- CodeBinaryOperatorExpression.cs
- UniformGrid.cs
- TableDetailsRow.cs
- CorrelationHandle.cs
- ServiceEndpointCollection.cs
- WebPartPersonalization.cs
- DefaultPropertyAttribute.cs
- MiniAssembly.cs
- EventLogSession.cs
- Hyperlink.cs
- RemoteArgument.cs
- CreateParams.cs
- IPipelineRuntime.cs
- EditorAttributeInfo.cs
- SafePointer.cs
- SqlUserDefinedAggregateAttribute.cs
- TrackingParticipant.cs
- SBCSCodePageEncoding.cs
- FileStream.cs
- Rectangle.cs
- CharacterMetricsDictionary.cs
- URLAttribute.cs
- UrlMappingsModule.cs
- AccessControlList.cs
- XmlTextReaderImpl.cs
- ProviderIncompatibleException.cs
- LicFileLicenseProvider.cs
- securestring.cs
- ClickablePoint.cs
- SynchronizationLockException.cs