摘要: 在上一讲介绍了使用lock来实现线程之间的同步。实际上,这个lock是C#的一个障眼法,在C#编译器编译lock语句时,将其编译成了调用Monitor类。先看看下面的C#源代码: Code highlighting produced by Actipro CodeHighlighter (freew... 阅读全文
posted @ 2015-02-13 11:02 Cat Qi 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 虽然线程可以在一定程度上提高程序运行的效率,但也会产生一些副作用。让我们先看看如下的代码:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->classIn... 阅读全文
posted @ 2015-02-13 11:00 Cat Qi 阅读(298) 评论(0) 推荐(0) 编辑