如何在VC ++中创建线程 [英] How to create threads in VC++

查看:336
本文介绍了如何在VC ++中创建线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




是用于在VC ++中创建线程的类中的任何构建,是否可以使用API​​在C ++中实现
..


提前致谢..


-Pugal.G

Hi

is it any build in class that used for creation of threads in VC++, is it
is possible to do it in C++ using APIs..

Thanks in advance..

-Pugal.G

推荐答案

你好Pugal!
Hi Pugal!

是用于在VC ++中创建线程的类中的任何构建,是

可以使用API​​在C ++中完成..
is it any build in class that used for creation of threads in VC++, is it
is possible to do it in C++ using APIs..



WinAPI:CreateThread

CRT:_beginthread(ex)

MFC:AfxBeginThread

..NET:新线程(新的ThreadStart(ThreadProc));


问候

Jochen


PS:WinAPI还支持光纤!

WinAPI: CreateThread
CRT: _beginthread(ex)
MFC: AfxBeginThread
..NET: new Thread(new ThreadStart(ThreadProc));

Greetings
Jochen

PS: WinAPI also supports fibers!


是否是用于创建线程的类中的任何构建VC ++,是
is it any build in class that used for creation of threads in VC++, is



可以使用API​​在C ++中完成..
it
is possible to do it in C++ using APIs..



你可以使用_beginthre adex这样做。

不要使用CreateThread。这是不安全的。


<引自 http://www.microsoft.com/msj/0797/multithreading.aspx >

最后,beginthreadex执行一些线程本地存储初始化,所以你

可以使用多线程C运行时库函数。 CreateThread没有
,因此与C运行时调用不兼容。

< / quote>


或如果您使用MFC,您可以使用CWinThread。

使用.NET,您可以使用Thread类。


-


亲切的问候,

Bruno van Dooren
br ********************** @ hotmail.com

仅删除 _nos_pam"

you can use _beginthreadex to do that.
Do not use CreateThread. it is not safe.

<quote from http://www.microsoft.com/msj/0797/multithreading.aspx >
Finally, beginthreadex does some thread local storage initialization so you
can use the multithreaded C runtime library functions. CreateThread doesn''t
and is, therefore, incompatible with C runtime calls.
</quote>

Or if you use MFC you could use CWinThread.
With .NET you can use the Thread class.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"


嗨Jochen和Bruno van Dooren


感谢您的快速帮助,现在我可以将我的项目转换为

多线程一个..


问候

-Pugal


" Pugal" ;写道:
hi Jochen and Bruno van Dooren

Thank you for your speedy help, right now I able convert my project into
multithreaded one..

Greetings
-Pugal

"Pugal" wrote:




是用于在VC ++中创建线程的类中的任何构建,是吗? />
可以使用API​​在C ++中完成..


提前致谢..


-Pugal.G
Hi

is it any build in class that used for creation of threads in VC++, is it
is possible to do it in C++ using APIs..

Thanks in advance..

-Pugal.G


这篇关于如何在VC ++中创建线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆