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
- RightsManagementProvider.cs
- HtmlControl.cs
- ServiceOperationDetailViewControl.cs
- RegisteredDisposeScript.cs
- StateFinalizationActivity.cs
- TripleDES.cs
- DataGridRelationshipRow.cs
- TextOutput.cs
- TypeDescriptionProviderAttribute.cs
- DesignTimeTemplateParser.cs
- DispatcherFrame.cs
- ToolStripRenderer.cs
- Point3DValueSerializer.cs
- VirtualDirectoryMapping.cs
- UnionExpr.cs
- ThreadStartException.cs
- DataGridItemCollection.cs
- NativeMethods.cs
- HttpWebRequestElement.cs
- CryptoApi.cs
- ExcludeFromCodeCoverageAttribute.cs
- RectConverter.cs
- DescendantOverDescendantQuery.cs
- Item.cs
- COM2AboutBoxPropertyDescriptor.cs
- TextSimpleMarkerProperties.cs
- CustomTypeDescriptor.cs
- DrawingServices.cs
- SessionStateSection.cs
- SurrogateDataContract.cs
- TypeUnloadedException.cs
- PointAnimationBase.cs
- UserValidatedEventArgs.cs
- XsdDuration.cs
- OutputCacheSection.cs
- CheckBoxFlatAdapter.cs
- SettingsBindableAttribute.cs
- _LocalDataStore.cs
- BufferedReceiveManager.cs
- _ConnectOverlappedAsyncResult.cs
- Pointer.cs
- TextSchema.cs
- XslAst.cs
- TraceInternal.cs
- SslStream.cs
- ScrollEvent.cs
- SizeFConverter.cs
- ManagementDateTime.cs
- ClassImporter.cs
- TreeNodeCollection.cs
- FacetValueContainer.cs
- BindingOperations.cs
- NetStream.cs
- PartBasedPackageProperties.cs
- LinkTarget.cs
- ConnectionConsumerAttribute.cs
- MemberAssignment.cs
- UserControlCodeDomTreeGenerator.cs
- PackageRelationship.cs
- CopyAction.cs
- listitem.cs
- ReferenceEqualityComparer.cs
- ExpressionLink.cs
- SafeCryptoHandles.cs
- NullableIntSumAggregationOperator.cs
- PersistChildrenAttribute.cs
- WeakReferenceKey.cs
- EmptyReadOnlyDictionaryInternal.cs
- DataErrorValidationRule.cs
- TemplateDefinition.cs
- RegisteredScript.cs
- SQLSingle.cs
- HwndSubclass.cs
- _FixedSizeReader.cs
- CacheOutputQuery.cs
- CatalogPart.cs
- SettingsPropertyWrongTypeException.cs
- WindowsListViewItem.cs
- PointAnimationUsingPath.cs
- FontUnit.cs
- Profiler.cs
- BaseCodePageEncoding.cs
- HyperLinkField.cs
- DescendantOverDescendantQuery.cs
- ParagraphResult.cs
- wgx_commands.cs
- MethodRental.cs
- TimeStampChecker.cs
- _NetworkingPerfCounters.cs
- UrlPath.cs
- PieceNameHelper.cs
- RestHandlerFactory.cs
- NumericUpDownAccelerationCollection.cs
- InstanceDescriptor.cs
- MenuBase.cs
- FtpCachePolicyElement.cs
- TableRowGroup.cs
- ArglessEventHandlerProxy.cs
- ContextDataSourceContextData.cs
- PerformanceCounter.cs