摘要: 8down voteTo begin, from your link:Control.Invoke: Executes on the UI thread, but calling thread waits for completion before continuing.Control.BeginInvoke: Executes on the asynchronous UI thread, and calling thread doesn't wait for completion.and from MSDN:BeginInvoke executes the specified del 阅读全文
posted @ 2011-09-07 16:36 higirle 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 先看以下代码: using System;using System.Text;using System.Windows.Forms;using System.Threading; namespace 线程间通讯{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } //1.创建Invoke函数,大致如下: /// <summary> /// Delegate function to be invoked by main thread /// </summary> pr 阅读全文
posted @ 2011-09-07 16:19 higirle 阅读(315) 评论(0) 推荐(0) 编辑
摘要: http://developer.51cto.com/art/200908/141606.htm--http://developer.51cto.com/art/200908/141606.htm本文继续C#线程系列讲座之四,C#线程同步与死锁。AD:在上一讲介绍了使用lock来实现C#线程同步。实际上,这个lock是C#的一个障眼法,在C#编译器编译lock语句时,将其编译成了调用Monitor类。先看看下面的C#源代码:public static void MyLock() { lock (typeof(Program)) { } } 上面的代码通过... 阅读全文
posted @ 2011-09-07 15:49 higirle 阅读(284) 评论(0) 推荐(0) 编辑