摘要:
线程同步傻问题:该被同步的变量没有用信号量控制,值是否会被改变 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading; 6 7 namespace testLockList 8 { 9 class Program10 {11 12 const int ThreadMaxNum = 5; //要启动的线程的最大数目13 static ... 阅读全文
posted @ 2013-01-02 01:26
陈哈哈
阅读(645)
评论(0)
推荐(0)
摘要:
本文主要用来说明多线程中异常情况的处理。 问题出现:使用Lock进行多线程中的同步的时候,如果在Lock块里面出现了异常,那么同步的资源(变量)就没有办法被释放,最终将导致线程死锁。 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading; 6 7 namespace testLockList 8 { 9 class Program10 {11 12 const int ... 阅读全文
posted @ 2013-01-02 00:35
陈哈哈
阅读(726)
评论(0)
推荐(0)

浙公网安备 33010602011771号