启用一个线程的Start方法
2013-04-27 22:10
295 查看
启动一个线程是调用 start() 方法,new一个ThreadStart class, 然后,把ThradStart class对象传给Thread类,Thread类start()
View Code
View Code
public class ThreadWork { public static void DoWork() { for (int i = 0; i < 5; i++) { Console.WriteLine("Working thread..{0}", i); Thread.Sleep(100); } } } class Program { static void Main(string[] args) { ThreadStart myStart = new ThreadStart(ThreadWork.DoWork); Thread myThread = new Thread(myStart); //启用一个Thread myThread.Start(); } }
相关文章推荐
- 从Thread.start()方法看Thread源码,多次start一个线程会怎么样
- 从Thread.start()方法看Thread源码,多次start一个线程会怎么样
- Java - 启动一个线程是调用run()方法还是start()方法?
- 当一个线程进入一个对象的一个synchronized()方法后,其他线程是否可进入此对象的其他方法?
- 第九天 设计一个方法,执行一次,一个线程对j加1,另外一个对j减一
- Java线程中run和start方法的区别
- C# 如何让 多线程中每个线程间隔毫秒执行同一个方法
- Java线程中run和start方法
- 笔试:当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法? ?(2nd)
- 当一个线程进入一个对象的synchronized() 方法后,其他线程是否可以进入此对象的其他方法
- BeginInvoke 方法真的是新开一个线程进行异步调用吗?
- 当一个线程进入一个对象的一个synchronized方法后,其它线程是否可进入此对象的其它方法
- NET中创建一个线程有几种方法
- Java线程中run和start方法的区别
- 重新想象 Windows 8 Store Apps (42) - 多线程之线程池: 延迟执行, 周期执行, 在线程池中找一个线程去执行指定的方法
- “Internet连接共享访问被启用时,出现了一个错误” 解决方法 .
- Android中返回数据到前一个Activity — startActivityForResult方法
- java线程wait()方法的一个应用场景
- 进程与线程的理解,以及run方法和start方法的区别
- 解决IIS不能发布MVC3项目的一个有效方法(windows7,IIS7,MVC3,启用目录浏览)