我们如何在C ++中创建线程? [英] how can we create a thread in C++?
本文介绍了我们如何在C ++中创建线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们如何在C ++中创建线程?
How can we create a thread in C++?
推荐答案
线程库依赖于平台(*),例如在Windows
上,您通常使用CreateThread
函数 [pthread_create
函数 [^ ].
如果您需要可移植性,请查看 Boost.Threads [ ^ ].
Thread libraries are platform dependent (*), for instance onWindows
you typically useCreateThread
function[^] while onLinux
you would usePOSIX
threads''pthread_create
function[^].
If you need portability then have a look at Boost.Threads[^].
我认为在Windows中使用_beginthreadex是更好的选择.请参考这个.
http://msdn.microsoft.com/en-us/library/kdzttdcb (v = vs.80).aspx [
I think in Windows using _beginthreadex is better option. Please refer this.
http://msdn.microsoft.com/en-us/library/kdzttdcb(v=vs.80).aspx[^]
该网站可以为您提供帮助
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html [
this site could help you
http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html[^]
这篇关于我们如何在C ++中创建线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文