多线程编程之二——mfc中的多线程开发(Multithreaded programming two - multi-threaded development in MFC).docVIP
- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
多线程编程之二——mfc中的多线程开发(Multithreaded programming two - multi-threaded development in MFC)
多线程编程之二——mfc中的多线程开发(Multithreaded programming two - multi-threaded development in MFC)
Five, MFC support for multi-threaded programming
There are two types of threads in MFC, called worker threads and user interface threads, respectively. The main difference between the two is that worker threads do not have message loops, and user interface threads have their own message queues and message loops.
Worker threads have no messaging mechanisms, which are often used to perform background calculations and maintenance tasks such as lengthy computing processes, printer background printing, and so on. User interface threads are typically used to handle user input other than the execution of other threads, and to respond to events and messages generated by users and systems. But for Win32s API programming, there is no difference between the two threads. They all start the thread with only the threads starting address to perform the task.
In MFC, the global function AfxBeginThread () is used to create and initialize the operation of a thread that has two overloaded forms, used to create worker threads and user interface threads, respectively. The two overloaded functions, prototypes, and parameters, are described below:
(1) CWinThread* AfxBeginThread (AFX_THREADPROC pfnThreadProc),
LPVOID pParam,
NPriority=THREAD_PRIORITY_NORMAL,
UINT nStackSize=0,
DWORD dwCreateFlags=0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs=NULL);
PfnThreadProc: points to the pointer of the worker threads execution function, and the thread function prototype must declare as follows: UINT ExecutingFunction (LPVOID pParam);
Note that ExecutingFunction () should return a value of type UINT to indicate the end of the function. Typically, a return of 0 indicates successful execution.
PParam: a 32 bit argument passed to the thread function, which is interpreted in some way by the executing function. It can be numeric, or pointer to a structure, and can even be ignored;
NPriority: thread priority. If 0, the thread
您可能关注的文档
- 名人里(Celebrity).doc
- 名字游戏(Name game).doc
- 名侦探柯南经典语句(Detective Conan classic sentence).doc
- 名侦探柯南经典语录(Detective Conan Classic Quotes).doc
- 名校硕士谈考研感谢六个月的痛苦备考(Master of fine arts talk about PubMed Thank you for six months of pain pro forma).doc
- 名言佳句积累训练(Logion accumulated training).doc
- 名言(Well-known saying).doc
- 名词的数(Number of nouns).doc
- 后分销时代石油和化工行业如何应对(How should the petroleum and chemical industry cope with the post distribution era).doc
- 名烟价格(The price of cigarettes).doc
最近下载
- 工商业储能项目商业计划书.docx
- 《主成分分析PCA》课件.ppt VIP
- 2024年秋季学期新外研版英语三年级上册课件 Unit 5 课时3 Fuel up.pptx
- HG∕T 2680-2017_工业硫酸镁 最新标准规范.pdf VIP
- 汽车维修中级工考证期末试卷.docx VIP
- 〖初中地理〗中国的工业课件-2025-2026学年八年级地理上学期(湘教版2024).pptx VIP
- 品牌授权使用合同.docx VIP
- 马克•温斯坦:高胜算交易者.pdf VIP
- 跨国公司海外项目当地员工安全培训与保障制度.pptx VIP
- 河南师范大学 340农业知识综合二 2014-2019(缺2016)年考研专业课真题.pdf VIP
原创力文档


文档评论(0)