技术标签: Yate学习 study_yate
请声明出处:
对象的引用计数的类,基本大部分的类都继承了该类:
/**
* A reference counted object.
* 引用计数的对象
* Whenever using multiple inheritance you should inherit this class virtually.
* 使用多重继承,一般都会继承这个类
*/
class YATE_API RefObject : public GenObject
{
YNOCOPY(RefObject); // no automatic copies please
public:
/**
* The constructor initializes the reference counter to 1!
* 构造函数,初始化引用计数器为1.
* Use deref() to destruct the object when safe
* 使用deref()去销毁这个对象在安全的时候
*/
RefObject();
/**
* Destructor.
*/
virtual ~RefObject();
/**
* Get a pointer to a derived class given that class name
* 获取一个指向派生类的指针,因为类名
* @param name Name of the class we are asking for
* @参数 name,请求的类名
* @return Pointer to the requested class or NULL if this object doesn't implement it
* @返回被请求类的地址,为NULL,如果这个对象没有实例化
*/
virtual void* getObject(const String& name) const;
/**
* Check if the object is still referenced and safe to access.
* 检查对象是否依旧被引用并且安全的访问
* Note that you should not trust this result unless the object is locked
* 注意,不能完全相信这个结果,除非对象被其他方法锁定
* by other means.
* @return True if the object is referenced and safe to access
* @返回True,如果对象被引用并且安全的访问
*/
virtual bool alive() const;
/**
* Increments the reference counter if not already zero
* 增加引用计数器,如果不为0
* @return True if the object was successfully referenced and is safe to access
* @返回True,如果对象被引用并且安全的访问
*/
bool ref();
/**
* Decrements the reference counter, destroys the object if it reaches zero
* 减少引用计数器,如果为0则销毁对象
* <pre>
* // Deref this object, return quickly if the object was deleted
* if (deref()) return;
* </pre>
* @return True if the object may have been deleted, false if it still exists and is safe to access
* @返回true,如果对象已经被删除,false,依旧存在并且安全的访问
*/
bool deref();
/**
* Get the current value of the reference counter
* 获取引用计数器当前的值
* @return The value of the reference counter
*/
inline int refcount() const
{ return m_refcount; }
/**
* Refcounted objects should just have the counter decremented.
* 引用计数对象减少计数器
* That will destroy them only when the refcount reaches zero.
* 当引用计数器为0的时候销毁
*/
virtual void destruct();
/**
* Check if reference counter manipulations are efficient on this platform.
* 检查在这个平台上引用计数器对象是否有效
* If platform does not support atomic operations a mutex pool is used.
* 如果该平台不支持原子操作使用互斥对象池
* @return True if refcount uses atomic integer operations
* @返回true,如果对象计数使用原子整数操作
*/
static bool efficientIncDec();
protected:
/**
* This method is called when the reference count reaches zero after
* 当该应用计数为0之后调用这个方法
* unlocking the mutex if the call to zeroRefsTest() returned true.
* 如果调用zeroRefsTest() 返回true,解除这个互斥锁
* The default behaviour is to delete the object.
* 默认删除这个对象
*/
virtual void zeroRefs();
/**
* Bring the object back alive by setting the reference counter to one.
* Note that it works only if the counter was zero previously
* @return True if the object was resurrected - its name may be Lazarus ;-)
*/
bool resurrect();
/**
* Pre-destruction notification, called just before the object is deleted.
* Unlike in the destructor it is safe to call virtual methods here.
* Reimplementing this method allows to perform any object cleanups.
*/
virtual void destroyed();
private:
int m_refcount;
Mutex* m_mutex;
};
文章浏览阅读881次。前端工程与性能优化 · Issue #3 · fouber/blog https://github.com/fouber/blog/issues/3
文章浏览阅读4.1k次,点赞2次,收藏20次。yolov5测试单张图片,返回一个列表[类别,置信度,x,y,w,h]from numpy import randomimport torchfrom models.experimental import attempt_loadfrom utils.datasets import LoadStreams, LoadImagesfrom utils.general import ( check_img_size, non_max_suppression, apply_classifier_yolov5测试单张图片
文章浏览阅读88次。从SQL改写到SQL重写,什么样的SQL才是好SQL?黄浩 2016-12-14 10:02:26作者介绍黄浩,现任职于中国惠普,从业十年,始终专注于SQL。十年一剑,十年磨砺。3年通信行业,写就近3万条SQL;5年制造行业,遨游在ETL的浪潮;2年性能优化,厚积薄发自成一家。在生活中,很多时候我们会有这样的体悟:问题要么不出,一旦出现,会像多诺米骨牌一样,会连锁引发诸多相关问题,让我们疲于应付。..._黄浩 sql
文章浏览阅读578次,点赞2次,收藏2次。==============================================================================================================教程&电子书==============================================================================================================C#入门经典_.net课程下载
文章浏览阅读3.8k次,点赞2次,收藏8次。来来来,这里解释下从网卡PHY到IP层的数据接收流程:这里是以函数调用方式来体现:netif_add——》ethernetif_init——》low_level_init——》ethernetif_input——》low_level_input和tcpip_input——》ethernet_input——》ip4_input(etharp_input、pppoe_disc_input)——》udp..._stm32f7 lwip
文章浏览阅读1.6w次。报错系统Centos报错提示Input/output error检查服务器机器中多硬盘是否其中有一块硬盘坏掉了。第二种可能:RAID阵列可能有问题。。。_linux 写入文件到挂载的nas下提示failed to close...input/output error
文章浏览阅读2.7k次,点赞7次,收藏23次。1. 简介C语言程序从源代码到可执行文件(二进制文件)都经历了那些过程?本文以Linux下C语言的编译过程为例,讲解C语言程序的编译过程。以hello.c文件为例:#include <stdio.h>int main(){ printf("hello world!\n");}在linux下编译C程序:$ gcc hello.c -o hello # 编译$ ./hello # 执行hello world! # 输出文本2. 编译的步骤gcc命令编译C语言的过程中_linux下编写一个c程序的基本过程分为几部分?
文章浏览阅读340次。pyqt5界面开发-制作多个小程序-基本的框架和思路最近现在无事,看到了电脑桌面,又想到了最近入门的pyqt5,再看看以往的程序,想到了可不可以做一个集成的UI桌面_用pyqt做程序集合的界面
文章浏览阅读2k次。第一部分(1-6):前端纯静态网页模板无后台+大量网站设计素材 1:PC模板: 9900套响应式html5+css3网页模板【页面齐,二级,三级页均有,含中文模板】 2:PSD模板:3000套PSD模板+600套Flash酷站源文件+千套矢量ICO图标 3:手机模板:2000套各行业中文手机..._chengren 电影
文章浏览阅读441次。连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining optionsORA-39001: 参数值无效ORA-39000: 转储文件说明错误ORA-39143: 转储文件 "F:\ora10G_expdp\ic_pri..._ora39143
文章浏览阅读3.4w次,点赞16次,收藏28次。#includemain(){ int n,a[40],i,count=0; printf("请输入学生人数:"); scanf("%d",&n); printf("请输入各学生成绩:\n"); for(i=0;i
文章浏览阅读391次。第一部分,JAVA基础和面向对象 part01 入门与开发环境搭建 1: 计算机基础知识(了解)(1)计算机(2)计算机硬件(3)计算机软件系统软件:windows,linux,mac应用软件:QQ,YY,扫雷,CS/F(4)软件开发就是用开发工具和计算机语言做出软件(5)计算机语言人与计算机的交流方式(6)人机交互A:图像界面方便,简单,直观。B:DOS 窗口方式要有控制台, 要记住很多的命令,..._cuser.getchinese().equals("null")