摘要:
当多个线程在并发的时候,难免会碰到相互冲突的事情,比如最经典的ATM机的问题,并发不可怕,可怕的是我们没有能力控制。 线程以我的理解可以分为三种 ① 锁。 ② 互斥。 ③ 信号。 好,这一篇主要整理“锁”,C#提供了2种手工控制的锁 一: Monitor类 这个算是实现锁机制的纯正类,在锁定的临界区 阅读全文
摘要:
using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { ManualResetEvent rem = new ManualResetEven... 阅读全文
摘要:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Wind... 阅读全文
摘要:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Wind... 阅读全文
摘要:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Th... 阅读全文