线程状态? [英] thread status?

查看:67
本文介绍了线程状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

感谢您阅读回复

我之前已经问过了,ho知道线程的状态.我得到了回复

我试过这样.

Hi all,

Thanks for reading the reply

I have asked earlier , ho to know the status of the thread.I got reply

I tried like this .

private void timer1_Tick(object sender, EventArgs e)
{
    Thread t = new Thread(new ParameterizedThreadStart(connectPara));
    t.Start("PS_LoginDetails_Delete1");
    
    Thread t1 = new Thread(new ParameterizedThreadStart(connectPara));
    t1.Start("PS_LoginDetails_Delete2");
    
    textBox4.Text = t1.ThreadState.ToString();
    textBox3.Text = t.ThreadState.ToString();
    
    if (t1.ThreadState == ThreadState.Stopped)
    {
        textBox4.Text = "t1 stoppped";
    }
    
    if (t.ThreadState == ThreadState.Stopped)
    {
        textBox4.Text = "t stoppped";
    }
    
}



如果有条件的话根本就不会进入内部.

我怀疑,在t1.start之后,这意味着我粘贴到代码下方的第六行.是否所有线程都将在此行之后执行.



It''s not at all going inside that if condition.

I have a doubt , after t1.start that means the 6 th line i have pasted below the code .are all the threads will get executed after this line.

Thread t = new Thread(new ParameterizedThreadStart(connectPara));
t.Start("PS_LoginDetails_Delete1");
    
Thread t1 = new Thread(new ParameterizedThreadStart(connectPara));
t1.Start("PS_LoginDetails_Delete2");



有人可以帮我粘贴一个代码片段来检查线程是否完成了它的工作.我对活动和代表的知识不多.我读了一些文章.我无法完全理解.

谢谢&问候



Can anybody help me to paste a code snippet to check whether the thread has finished it''s job or not . I don''t have much knowledge of events and delegates. I read some articles . I couldn''t get it fully.

Thanks & regards

推荐答案

http://www.codeguru.com/csharp/csharp/cs_syntax/print.php/c5851 [ ^ ]


这篇关于线程状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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