public void GuiSyncDispatch(StatefulMessageHandler cb, object state) { if (IsGuiThread) { cb (state); return; } StatefulMessageContainer mc = new StatefulMessageContainer (cb, state, true); lock (mc) { QueueMessage (mc); Monitor.Wait (mc); } if (mc.Exception != null) throw new Exception (errormsg, mc.Exception); }
public void ThreadDispatch(StatefulMessageHandler cb, object state) { StatefulMessageContainer smc = new StatefulMessageContainer (cb, state, false); Thread t = new Thread (new ThreadStart (smc.Run)); t.IsBackground = true; t.Start (); }