惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - Blue

个已实现的例子:通过Javascript在页面中直接调用Office Communicator API - Blue cmd脚本(C# 清缓存) - Blue - 博客园 isql脚本编写创建数据库(SQL Server2000) 怎样踢mstsc占用者 copy:键盘按键和键盘对应代码表 转:ListView 中添加大数据量解决屏幕刷新“闪”的现象 Regsvr32命令全攻略 导入导出CVS文件遇到的问题 - Blue - 博客园 一个字段存很多枚举值,然后从字段取出的方法 關於泛型的資料 索引器的两种用法 在建表时使用DEFAULT是很有用的 关于web service的验证 SQL中计算月初和月末 临时表有时很有用 在GROUP语句中还可以增加很多内容 注意insert语句写法 case的用法 尽量减少使用游标
Thread简单概念
Blue · 2008-08-28 · via 博客园 - Blue

一些简单概念:
Thread.Start
():启动线程的执行;
Thread.Abort
():以开始终止此线程的过程。如果线程已经在终止,则不能通过Thread.Start()来启动线程。
Thread.Suspend
():挂起线程,或者如果线程已挂起,则不起作用;
Thread.Resume
():继续已挂起的线程;
Thread.Interrupt
():中断处于 Wait Sleep Join 线程状态的线程;
Thread.Join
():阻塞调用线程,直到某个线程终止时为止
Thread.Sleep
():将当前线程阻塞指定的毫秒数;

Thread.Abort()方法使得系统悄悄的销毁了线程而且不通知用户。一旦实施Thread.Abort()操作,该线程不能被重新启动。调用了这个方法并不是意味着线
程立即销毁,因此为了确定线程是否被销毁,我们可以调用Thread.Join()来确定其销毁,Thread.Join()是一个阻塞调用,直到线程的确是终止了才返回。

  private void StartThread( ref Thread thread, ThreadStart threadStart )
  {
   if ( thread != null )
   {
    thread.Abort(); //
终止此线程的过程。如果线程已经在终止,则不能通过Thread.Start()来启动线程。
    thread.Join();  //
调用Thread.Abort()操作并不是意味着线程立即销毁,因此为了确定线程是否被销毁,我们可以调用Thread.Join()来确定其销毁
    thread = null;  //
初始化
   }

   thread = new Thread( threadStart );  // 重新实例化一个线程
   thread.IsBackground = true;    //
线程在后台执行
   thread.Start();
  }

  private void StopThread(Thread thread )
  {
   if ( thread != null )
   {
    thread.Abort();
    thread.Join();
    thread = null;
   }
  }