public EventWaitHandle CallDelegInMainLoop (System.Action d)
{
exceptionHappened = null;
EventWaitHandle wakeUpInMainLoop = new AutoResetEvent (false);
lock (this.forState) {
if (this.internalState != ThreadState.Running)
throw new NotSupportedException ("The Mainloop is not running yet.");
lastHandle = wakeUpInMainLoop;
}
try {
return wakeUpInMainLoop;
}
finally {
Gtk.Application.Invoke ( delegate { d (); wakeUpInMainLoop.Set (); });
}
}