如何再次运行Windows窗体线程? [英] How to run again thread Windows Forms?

查看:84
本文介绍了如何再次运行Windows窗体线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序(Windows窗体)有两个线程(A,B).现在我想在
中运行2个线程 我的应用程序(5秒后重复2个线程)????

My application (Windows Forms) has two thread (A, B). Now i want to run 2 threads in
my app (after 5 seconds to repeat 2 thread)????

Can you help me????

推荐答案

一旦线程中止或正常终止,您将无法重新启动它.您必须重新实例化.
Once a thread is aborted or terminates normally, you can''t just restart it. You have to reinstantiate it.


是否要每隔5秒不断创建新线程?或考虑使用线程池?

如果是线程池,则可以从此处 http://msdn.microsoft开始. com/en-us/library/3dasc8as%28v = vs.80%29.aspx [
Are you going to continuously create new threads at every 5 seconds interval? or think about using a Thread Pool?

If thread pool you can start with here http://msdn.microsoft.com/en-us/library/3dasc8as%28v=vs.80%29.aspx[^] + google + code project has many expert answers already in threading I guess.


不要重新开始!使它永远运行,但不使用时保持等待状态.

在这里查看我最近的解决方案:
仅运行一个作业/线程Web服务中永远不会终止的/process(asp.net) [
Don''t start it again! Make it run forever but keep it in a wait state when not used.

See my recent Solution here: Running exactly one job/thread/process in webservice that will never get terminated (asp.net)[^]. Trust me (but try it by yourself), this is much better solution.

—SA


这篇关于如何再次运行Windows窗体线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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