简体   繁体   English

作法:在Windows平台上执行绪(C ++)

[英]How to: Threading on windows platform (C++)

I shall like to know how to use threading on windows platform. 我想知道如何在Windows平台上使用线程。 Do I need to include some lib or dll file? 我需要包括一些lib或dll文件吗? Is there some command? 有命令吗?

我将使用Boost.Thread ,您可以通过它获得可移植性以及易用性。

The Windows API (Win32) includes a number of threading tools. Windows API(Win32)包括许多线程工具。

Since you tagged this as C++ and not C, you might however consider using something more elaborate like just::thread (or std::thread if your compiler supports it) or Boost.Thread like usta suggested. 由于您将其标记为C ++而不是C,因此,您可以考虑使用更复杂的方法,例如:: thread (如果编译器支持,则为std :: thread)或建议的Boost.Thread(如usta)。

使用常规的CRT / Windows API句柄和函数( _beginthread,_beginthreadex等)或MFC类,例如本示例

有关也可移植(可在任何平台上运行)的有关C ++ 0x线程标准的文档,您也可以在此处查看以下内容: http ://accu.org/var/uploads/journals/overload93.pdf(请参阅C中的多线程文章++ 0x)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM