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
- XmlEventCache.cs
- RangeValidator.cs
- DocumentApplication.cs
- RedirectionProxy.cs
- QuaternionAnimation.cs
- DocumentApplication.cs
- QueueNameHelper.cs
- dtdvalidator.cs
- SortedDictionary.cs
- SortQuery.cs
- ConfigsHelper.cs
- DataGridTable.cs
- Attributes.cs
- HtmlHead.cs
- VisualCollection.cs
- SafeProcessHandle.cs
- DesignTimeTemplateParser.cs
- BinaryHeap.cs
- FormClosingEvent.cs
- QuadraticEase.cs
- ChangePassword.cs
- WebPartCatalogCloseVerb.cs
- WebPartEditorApplyVerb.cs
- DataGridView.cs
- ApplicationCommands.cs
- ListItemDetailViewAttribute.cs
- Token.cs
- ValueHandle.cs
- FaultImportOptions.cs
- ListView.cs
- OleDbWrapper.cs
- WindowsStatic.cs
- SystemKeyConverter.cs
- WebControl.cs
- AdPostCacheSubstitution.cs
- CodeAttachEventStatement.cs
- BinaryObjectInfo.cs
- LinkArea.cs
- TypeLibConverter.cs
- CategoryValueConverter.cs
- DataListItemCollection.cs
- ConsoleKeyInfo.cs
- DictionaryEntry.cs
- RuleInfoComparer.cs
- DocumentReferenceCollection.cs
- TableRowGroup.cs
- SourceFileBuildProvider.cs
- PasswordRecovery.cs
- DataColumnSelectionConverter.cs
- PropertyEmitter.cs
- DataRowExtensions.cs
- CheckBoxField.cs
- FixedSOMTableRow.cs
- ResXFileRef.cs
- rsa.cs
- Task.cs
- TileBrush.cs
- FormViewPageEventArgs.cs
- GlobalAllocSafeHandle.cs
- ListItemCollection.cs
- ConstrainedGroup.cs
- UIElementPropertyUndoUnit.cs
- ErrorsHelper.cs
- DataTableExtensions.cs
- ProxyOperationRuntime.cs
- SoapFault.cs
- BamlReader.cs
- IsolatedStorageFileStream.cs
- XPathAncestorQuery.cs
- SqlNamer.cs
- safesecurityhelperavalon.cs
- ListViewDeletedEventArgs.cs
- DisposableCollectionWrapper.cs
- GlyphRun.cs
- MsmqIntegrationBindingElement.cs
- HtmlFormWrapper.cs
- TaiwanLunisolarCalendar.cs
- WeakHashtable.cs
- ByteFacetDescriptionElement.cs
- XmlUnspecifiedAttribute.cs
- URLAttribute.cs
- GestureRecognizer.cs
- EventSinkActivityDesigner.cs
- TableRowGroup.cs
- CqlLexerHelpers.cs
- UnsafeNativeMethods.cs
- XmlObjectSerializerReadContext.cs
- WebPartZone.cs
- SendReply.cs
- XmlAttributes.cs
- DocumentEventArgs.cs
- DataObject.cs
- TargetConverter.cs
- DynamicPropertyReader.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- OracleConnection.cs
- XmlSchema.cs
- DrawTreeNodeEventArgs.cs
- WindowsFont.cs
- ReturnEventArgs.cs