进程&线程

Posted ☆☆☆☆☆

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了进程&线程相关的知识,希望对你有一定的参考价值。

进程:当前进行中的程序(using System.Diagnostics;)

Process.start("浏览器名","http://网页连接");   

Process.start("http://网页连接");      ----用默认浏览器打开

Process.start("进程名");

Process p =new Process();

p.StartInfo=new ProcessStartInfo("绝对路径");

p.start();

----

string[] s=Process.GetProcesses();

foreach(Process p in s)

{

   p.kill();

}                              -----关闭计算机所有进程;

---------------------

线程:(using System.Threading;)一个进程可以有多个线程,前台线程与后台线程(th.IsBackground = true;)

Thread th =new Thread(委托);            ----委托的内容为函数的内容;

th.IsBackground = true;     --设置为后台线程;

th.start();             --开始

th.abort();                           --停止

Thread.sleep(毫秒);           --线程延迟;

允许跨线程访问控件:构造函数中 Control.CheckForIllegalCrossThreadCalls = false;

以上是关于进程&线程的主要内容,如果未能解决你的问题,请参考以下文章

进程 && 线程

多线程技术&KLT与ULT&多线程实现混合策略

线程 & 进程

python学习笔记-(十三)线程进程多线程&多进程

线程池&进程池

python--多线程&多进程