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
- CharConverter.cs
- RequestCacheValidator.cs
- SpotLight.cs
- TextTreeUndoUnit.cs
- RuleSettingsCollection.cs
- ObjectResult.cs
- GPRECTF.cs
- BitmapEffectInputData.cs
- BitmapEffectRenderDataResource.cs
- Marshal.cs
- FlowDocumentPaginator.cs
- Evaluator.cs
- ElementAction.cs
- XmlSerializerOperationFormatter.cs
- DrawingCollection.cs
- PropertyMapper.cs
- BamlResourceSerializer.cs
- BinaryObjectInfo.cs
- ResourceManagerWrapper.cs
- OdbcTransaction.cs
- PointLightBase.cs
- DocumentAutomationPeer.cs
- MessageHeaderAttribute.cs
- SymmetricAlgorithm.cs
- ToolboxItemCollection.cs
- FilterException.cs
- Input.cs
- FlowDocument.cs
- BaseParaClient.cs
- Accessible.cs
- UnsafeNativeMethodsMilCoreApi.cs
- XPathBuilder.cs
- TextChange.cs
- ClientConfigPaths.cs
- RoutingBehavior.cs
- ExtensibleClassFactory.cs
- CommandField.cs
- TextClipboardData.cs
- HtmlControlPersistable.cs
- CharacterString.cs
- typedescriptorpermissionattribute.cs
- NewItemsContextMenuStrip.cs
- ComponentDispatcher.cs
- DesignerTextWriter.cs
- UpdatePanel.cs
- BinarySecretKeyIdentifierClause.cs
- SmiEventSink.cs
- TemplatedMailWebEventProvider.cs
- StrokeNodeEnumerator.cs
- ColorIndependentAnimationStorage.cs
- ComplexObject.cs
- DependencyPropertyChangedEventArgs.cs
- InvalidCastException.cs
- ValuePatternIdentifiers.cs
- ReferenceEqualityComparer.cs
- SoapAttributeOverrides.cs
- OperationCanceledException.cs
- VisualBasicSettingsHandler.cs
- VirtualizingPanel.cs
- ButtonBase.cs
- WebProxyScriptElement.cs
- FileIOPermission.cs
- BaseCAMarshaler.cs
- DragDrop.cs
- SqlTriggerContext.cs
- DCSafeHandle.cs
- _ConnectionGroup.cs
- FieldDescriptor.cs
- Group.cs
- TextBoxBase.cs
- FunctionImportElement.cs
- XmlValueConverter.cs
- DESCryptoServiceProvider.cs
- SessionIDManager.cs
- DisplayInformation.cs
- DataGridViewCellPaintingEventArgs.cs
- DataViewSettingCollection.cs
- DocumentViewerBaseAutomationPeer.cs
- TextTreeUndoUnit.cs
- ContractNamespaceAttribute.cs
- ArgIterator.cs
- IsolatedStorageException.cs
- DBCommandBuilder.cs
- OracleInfoMessageEventArgs.cs
- documentsequencetextpointer.cs
- DataViewManagerListItemTypeDescriptor.cs
- Exceptions.cs
- FormsAuthentication.cs
- MasterPageBuildProvider.cs
- FrameworkObject.cs
- metrodevice.cs
- TreeNode.cs
- ObjectResult.cs
- TextCompositionManager.cs
- Baml6Assembly.cs
- Inflater.cs
- AddInSegmentDirectoryNotFoundException.cs
- DataTemplateSelector.cs
- ShapingWorkspace.cs
- ExpressionNode.cs