Gtk.ThreadNotify Class
Multi-threaded integration with Gtk support.

See Also: ThreadNotify Members

Syntax

public class ThreadNotify : IDisposable

Remarks

You should consider using Application.Invoke instead of this class as it provides a simpler interface.

The ThreadNotify class is used to invoke methods in the Gtk+ thread. Since Gtk is not a thread-safe toolkit, only a single thread at a time might be making calls into Gtk.

Typically applications will be executing the main Gtk+ main loop and when threads are done processing work, they invoke ThreadNotify.WakeupMain() to invoke a method on the main Gtk+ thread.

C# Example

using Gtk;

class Demo {

  static ThreadNotify notify;

  static void Main ()
  {
    Application.Init ();
    notify = new ThreadNotify (new ReadyEvent (ready));
    Application.Run ();
  }

  static void ready ()
  {
    // Update the GUI with computation values.
  }

  static void ThreadRoutine ()
  {
	LargeComputation ();
        notify.WakeupMain ();
  }

  static void LargeComputation ()
  {
    // lots of processing here
  }
}
  

Requirements

Namespace: Gtk
Assembly: gtk-sharp (in gtk-sharp.dll)
Assembly Versions: 2.12.0.0