2010年12月9日

线程的两种类型

摘要: 我们使用AfxBeginThread启动一个线程时,无外乎2种方法: 1.直接启动已CWinThread为基类的线程类-AfxBeginThread(RUNTIME_CLASS(...),...);2.直接启动标准的线程函数-AfxBeginThread((AFX_THREADPROC),LPVOID ,....); 有一种方法可能大家不常用,就是以CWinThread继承一线程类,在内存中new,然后调用CWinThread的成员函数CreateThread来启动自身;经过分析,实际上第1种和第2种方法就是第3中方法的详细化,调用更加灵活,但1、2种比起来要方便些。 阅读全文

posted @ 2010-12-09 08:45 cy163 阅读(681) 评论(0) 推荐(0)

Never use AfxEndThread! 一个非常好的例子

摘要: http://www.codeguru.com/forum/showthread.php?t=284440Hello,Thanks for the new forum. I thought I would put in a tip / warning that I have discovered and if anyone would like to comment on it, please do.Recently I developed a program that allowed the user to select a file, and then a worker thread wo 阅读全文

posted @ 2010-12-09 07:00 cy163 阅读(923) 评论(0) 推荐(0)

导航