随笔分类 - 多线程
摘要:public delegate string CaptureHandler(string ip); public class CaptureService { public static string CapturePicture(string ip) { Threa...
阅读全文
摘要:用ManulResetEvent实现生产者消费者,声明了两个ManulResetEvent类型变量,其实用一个也可以。现在用AutoResetEvent实现。Auto和Manual的区别是Auto只唤醒一个线程,Manual是唤醒所有。 public class AreTest ...
阅读全文
摘要:public class MreTest1 { public static ManualResetEvent mre = new ManualResetEvent(false); public static void Add() ...
阅读全文
摘要:private static Mutex m = new Mutex(); static bool p = true; public static void A() { while (true) { ...
阅读全文
摘要:static object locker = new object(); public void A() { while (true) { lock (locker) ...
阅读全文
摘要:class Program { static void Main(string[] args) { //控制台默认输出行数是300,可以设置 Console.BufferHeight = 1000; ...
阅读全文
浙公网安备 33010602011771号