IReferenceCounted DotNetty.Common

 1 // Copyright (c) Microsoft. All rights reserved.
 2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3 
 4 namespace DotNetty.Common
 5 {
 6     /// <summary>
 7     /// 引用计数的可复用对象的接口
 8     /// </summary>
 9     public interface IReferenceCounted
10     {
11         /// <summary>
12         /// 返回此对象的引用计数
13         /// </summary>
14         int ReferenceCount { get; }
15 
16         /// <summary>
17         /// 保留 引用计数 +1
18         /// </summary>
19         IReferenceCounted Retain();
20 
21         /// <summary>
22         ///  增加引用计数   <see cref="increment" />.
23         /// </summary>
24         IReferenceCounted Retain(int increment);
25 
26         /// <summary>
27         ///   触摸 为调试目的,记录当前对象的访问位置。
28         ///   如果这个对象是确定被泄露,信息记录这一操作 
29         /// </summary>
30         /// <returns></returns>
31         IReferenceCounted Touch();
32 
33         /// <summary>
34         ///     记录该对象的当前访问的位置,用于调试目的额外的任意信息。
35         ///     如果该对象被确定为泄漏,此操作记录的信息将通过 资源泄漏检测器 <see cref="ResourceLeakDetector" /> 提供给您
36         ///     
37         /// </summary>
38         IReferenceCounted Touch(object hint);
39 
40         /// <summary>
41         ///   减少引用计数1和释放该对象的引用计数达到0时。
42         /// </summary>
43         /// <returns>true :当且仅当引用计数为0,此对象已经被释放</returns>
44         bool Release();
45 
46         /// <summary>
47         ///  减少引用计数,释放该对象如果引用计数为0时 <see cref="decrement" />  
48         /// </summary>
49         /// <returns>true 当且仅当引用计数为0,此对象已被释放</returns>
50         bool Release(int decrement);
51     }
52 }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值