playerken

博客园 首页 新随笔 联系 订阅 管理

2014年11月27日 #

摘要: What is this resignFirstResponder business? Here is the short version:Some view objects are also controls. A control is a view that the user can inter... 阅读全文
posted @ 2014-11-27 17:38 playerken 阅读(394) 评论(0) 推荐(0) 编辑

摘要: 目录控制开关,若存在则创建log文件,输出。宏函数,若debug打开,则输出。多线程输出到同一文件。通过mutex控制多个进程同时创建log文件。 阅读全文
posted @ 2014-11-27 14:51 playerken 阅读(122) 评论(0) 推荐(0) 编辑

2014年11月12日 #

摘要: However, because the reference is weak, the object that self points to could be deallocated while theblock is executing.You can eliminate this risk by... 阅读全文
posted @ 2014-11-12 16:48 playerken 阅读(178) 评论(0) 推荐(0) 编辑

2014年11月5日 #

摘要: Here is a quick summary: A strong reference will keep the object it points to from being deallocated. Aweak reference will not. Thus instance variable... 阅读全文
posted @ 2014-11-05 17:48 playerken 阅读(176) 评论(0) 推荐(0) 编辑

2014年9月29日 #

摘要: 概述:注册生成dump文件的函数。当程序收到没有捕获的异常时,调用上述函数,生成dump文件。利用Windbg结合编译程序时生成的pdb和代码来分析dump文件,定位问题。如下代码生成dump文件(转):#include #include #include #pragma comment(lib... 阅读全文
posted @ 2014-09-29 16:03 playerken 阅读(11675) 评论(0) 推荐(0) 编辑

2014年9月25日 #

摘要: #include #include #define LOG_PATH "c:\\NetBiosUtilDll.log"// Use global object to ensure initialization and release.class GlobalEnv{public: GlobalEn... 阅读全文
posted @ 2014-09-25 16:42 playerken 阅读(162) 评论(0) 推荐(0) 编辑

2013年1月25日 #

摘要: extern "C" int lsof_entry( int argc, char *argv[] );bool OSRunLsof( const wxString &strTempPath ){ // create a temp file to retrieve the lsof result. wxString strLsofFile = OSCreateTempFileName( strTempPath + "lof" ); if( strLsofFile.IsEmpty() ) { LogDebug( "OSRunLsof() 阅读全文
posted @ 2013-01-25 15:00 playerken 阅读(1402) 评论(0) 推荐(0) 编辑

2011年10月26日 #

摘要: 线程需要在下面两种情况下互相进行通信:• 当有多个线程访问共享资源而不使资源被破坏时。• 当一个线程需要将某个任务已经完成的情况通知另外一个或多个线程时。原子访问:互锁的函数家族所谓原子访问,是指线程在访问资源时能够确保所有其他线程都不在同一时间内访问相同的资源。编译器生成代码的方法,哪个CPU在执行这个代码,以及主计算机中安装了多少个CPU等因素,决定了产生的结果可能是不同的。InterlockedExchangeAdd函数能够保证值的递增以原子操作方式来完成。所有线程都应该设法通过调用这些函数来修改共享的长变量,任何线程都不应该通过调用简单的C语句来修改共享的变量。还必须保证传递给这些函数 阅读全文
posted @ 2011-10-26 22:03 playerken 阅读(291) 评论(0) 推荐(0) 编辑

2011年10月20日 #

摘要: 每隔20ms左右,Windows要查看当前存在的所有线程内核对象。在这些对象中,只有某些对象被视为可以调度的对象。Windows选择可调度的线程内核对象中的一个,将它加载到CPU的寄存器中,它的值是上次保存在线程的环境中的值。这项操作称为上下文转换。Windows被称为抢占式多线程操作系统,因为一个线程可以随时停止运行,随后另一个线程可进行调度。暂停和恢复线程的运行在线程内核对象的内部有一个值,用于指明线程的暂停计数。当调用CreateProcess或CreateThread函数时,就创建了线程的内核对象,并且它的暂停计数被初始化为1。这可以防止线程被调度到CPU中。当线程完全初始化好了之后, 阅读全文
posted @ 2011-10-20 22:00 playerken 阅读(1306) 评论(0) 推荐(1) 编辑

2011年9月13日 #

摘要: STL中的string类采用了Copy On Write技术。即通过拷贝构造函数创建的对象不分配新的资源,引用原对象的资源。只有当写操作时,才分配新的资源。如下代码(GCC)演示了通过拷贝构造函数创建的string拥有相同的地址。当改变string的值时,重新分配字符串数组,地址改变。#includ... 阅读全文
posted @ 2011-09-13 21:54 playerken 阅读(1779) 评论(0) 推荐(0) 编辑