[Gtk-sharp-list] How to stop an Idle Thread

KLessou klessou at gmail.com
Wed Feb 28 10:00:05 EST 2007


Yes,

Thx !

But now I have another problem : how to wait the end of the method's
execution. ?

public class HelloWorld {
  public void hello (object obj, EventArgs args)
  {
     Console.WriteLine ("Hello World");

     // How to wait the end of OnIdleHello ?

     Glib.Source.Remove (my_uint);
     i = 0;
     my_uint = GLib.Idle.Add (new IdleHandler (OnIdleHello));
     OnIdleHello();
  }

  public void OnIdleHello ()
  {
     while (i <= 100)
     {
       Console.WriteLine(i);
       Console.WriteLine(i+1);
       Thread.Sleep(3000);
     }
  }

On 2/27/07, Peter Johanson <latexer at gentoo.org> wrote:
>
> On Tue, Feb 27, 2007 at 06:01:40PM +0000, KLessou wrote:
> >    Hello can we synchronize Glib.Idle Thread ?
>
> <snip />
>
> >
> >         // How to stop the previous Thread here ?
> >         GLib.Idle.Add (new IdleHandler (OnIdleHello));
>
> GLib.Idle.Add returns a uint value, which can later be removed with:
>
> GLib.Source.Remove (my_uint);
>
> That should do what you want.
>
> -pete
>
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
>



-- 
~~~~~
| klessou |
~~~~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070228/9adb990e/attachment-0001.html 


More information about the Gtk-sharp-list mailing list