因为线程应用程序正在被绞死 [英] Because of thread application is getting hanged

查看:70
本文介绍了因为线程应用程序正在被绞死的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在我的应用程序中使用Thread时遇到问题。由于使用了线程,应用程序正在被绞死。如果有人有解决方案,请给我。提前致谢。





Hi,
I have a problem using Thread in my application. The application is getting hanged because of using a thread.if anyone have the solution please give me. Thanks in advance.


//This is declared Globally
 Thread TrdCopyFLV=new TrdCopyFLV();

//this is called in a timer
if (TrdCopyFLV == null || !TrdCopyFLV.IsAlive)
                   {
                       //TrdCopyFLV = new Thread(delegate() { ConvertToFlv(lOpr1, lOpr2); });
                       TrdCopyFLV = new Thread(ThreadConvertToFlv);
                       TrdCopyFLV.IsBackground = true;
                       TrdCopyFLV.Priority = ThreadPriority.Lowest;
                       TrdCopyFLV.Start();
                   }

推荐答案

根据你的代码,我知道在每个计时器滴答中都有多个Thread正在执行。我认为这会引起问题。尝试解决问题。如果你以正确的方式处理它,线程永远不会妨碍你的应用。

--RA
As per your code, I understood there are multiple Threads are executing in every timer tick. I think that causing problem. Try to fix the problem. Threads never hags yours application, if you handle it in proper way.
--RA


这篇关于因为线程应用程序正在被绞死的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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