GailTestApp.MovingThread.CallDelegInMainLoop C# (CSharp) Method

CallDelegInMainLoop() public method

public CallDelegInMainLoop ( System d ) : EventWaitHandle
d System
return System.Threading.EventWaitHandle
		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 (); });
			}
		}

Usage Example

Ejemplo n.º 1
0
        public static void Kill(MovingThread thread)
        {
            EventWaitHandle wh = thread.CallDelegInMainLoop(KillMe);

            wh.WaitOne();
            if (thread.ExceptionHappened != null)
            {
                throw thread.ExceptionHappened;
            }
            wh.Close();
        }
All Usage Examples Of GailTestApp.MovingThread::CallDelegInMainLoop