c ++/CLI线程无法连续运行 [英] c++/CLI threading not running continuously
本文介绍了c ++/CLI线程无法连续运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我正在尝试在我的c ++/CLI项目中进行线程化.
我没有很多经验:(
我有命令:
Hi
I am trying to do threading in my c++/CLI project.
I don''t have a lot of experience in it :(
I have the command:
SnifThread = gcnew Thread(gcnew ThreadStart(this,&test4::Form1::snif_data));
然后
SnifThread -> Start();
该线程运行一次,完成后停止运行.
为什么会这样?
如何保持线程前进?
谢谢
Emmos
The thread runs once and after it finished it stops going.
Why is that happening?
How can I keep my thread going?
Thanks
Emmos
推荐答案
在您的Form1::snif_data
中放置一个while(running)
循环,它将继续.
您可以通过将running
设置为false
来杀死线程.
Put awhile(running)
loop in yourForm1::snif_data
and it will continue.
You can kill the thread by settingrunning
tofalse
.
这篇关于c ++/CLI线程无法连续运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文