摘要:
1.要编译的代码如下: using System; using System.Collections.Generic; using System.Text; namespace HellowWorld { class Program { static void Main() { ... 阅读全文
posted @ 2008-11-23 22:31
herobeast
阅读(231)
评论(0)
推荐(0)
摘要:
在.net中线程同步有一下几种方式: 1.lock语句 2.监视器 3.同步事件和等待句柄 4.Mutex对象 lock语句用于给对象获取互斥锁,执行操作语句,然后再释放该锁。在线程同步时,lock关键字将语句块标记为临界区,能保证代码顺利执行而不被其他线程中断,变量被包装在独占锁中。其他线程只能等待执行解锁之后才能访问改对象。如下 public static void Mian... 阅读全文
posted @ 2008-11-23 22:30
herobeast
阅读(461)
评论(0)
推荐(0)

浙公网安备 33010602011771号