首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > C# > Visual C#创建两个基本的线程(多线程)实例

Visual C#创建两个基本的线程(多线程)实例

  • 资源大小:9.24 kB
  • 上传时间:2021-06-29
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: C#源码

资 源 简 介

Visual C#创建两个基本的线程(多线程)实例,为了演示方便,这里把本实例 写成了一个控制台程序,创建两个线程后,通过控制台输出线程信息,演示了两个线程同时工作,下面来看具体代码:   创建两个基本的线程:   Thread thread1 = new Thread(new ThreadStart(Thread1)); //使用自定义方法Thread1声明线程   thread1.Priority = ThreadPriority.Lowest;//设置线程的调度优先级   Thread thread2 = new Thread(new ThreadStart(Thread2)); //使用自定义方法Thread2声明线程   thread1.Start();//开启线程一   thread2.Start();//开启线程二   定义函数向控制台输出线程:   static void Thread1()   {    Console.WriteLine("线程一");   }   输出线程二则可按照上面再创建一个函数,不再列举源码了。

文 件 列 表

codesc.net
SetThreadPri
SetThreadPri
SetThreadPri
obj
Debug
SetThreadPri.csproj.FileListAbsolute.txt
codesc.net
VIP VIP
0.183997s