摘要: using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Remoting.Messaging; using System.Text; using System.Threading; 阅读全文
posted @ 2022-06-15 16:53 sbwynnss 阅读(367) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2022-06-13 21:38 sbwynnss 阅读(158) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading; using System.T 阅读全文
posted @ 2022-06-12 15:53 sbwynnss 阅读(131) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace 阅读全文
posted @ 2022-06-11 20:48 sbwynnss 阅读(217) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net.Sockets; using Sy 阅读全文
posted @ 2022-06-09 21:00 sbwynnss 阅读(12) 评论(0) 推荐(0) 编辑
摘要: class Program { static public void test() { Console.WriteLine("任务开始"); Thread.Sleep(3000); Console.WriteLine("任务结束"); } static void Main(string[] args 阅读全文
posted @ 2022-06-09 13:51 sbwynnss 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 只有一个前台线程在运行,应用程序的进程就在运行,如果多个前台线程在运行,但是Main方法结束了,应用程序的进程仍然是运行的,直到所有的前台线程完成其任务为止。 在默认情况下,用Thread类创建的线程是前台线程。线程池中的线程总是后台线程。在用Thread类创建线程的时候,可以设置IsBackgro 阅读全文
posted @ 2022-06-09 09:27 sbwynnss 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 使用线程池需要注意的事项: 1、线程池中的所有线程都是后台线程 。 如果进程的所有前台线程都结束了,所有的后台线程就会停止。 不能把入池的线程改为前台线程 。2、不能给入池的线程设置优先级或名称。3、入池的线程只能用于时间较短的任务。 如果线程要一直运行就应使用Thread类创建一个线程。 usin 阅读全文
posted @ 2022-06-08 20:36 sbwynnss 阅读(195) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace 阅读全文
posted @ 2022-06-08 19:55 sbwynnss 阅读(41) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace 阅读全文
posted @ 2022-06-08 16:40 sbwynnss 阅读(33) 评论(0) 推荐(0) 编辑