[Gtk-sharp-list] AsyncCallback + Gtk?

Todd Berman tberman@sevenl.net
Thu, 08 Apr 2004 15:38:01 -0400


Well, i am not sure how you are using gtk, etc, but here is the basic
deal.

You can't touch gtk+ from threads other than the main thread. What
thread notify does is a small trick to get the function you setup to
thread notify running in the main thread. That way you can do gui
interaction from that code. There are other ways to managed this, and
how do you so is up to you. But making sure you are in the main thread
before touching gtk objects is a good thing.

--Todd

On Thu, 2004-08-04 at 15:34 -0400, Matt Eaton wrote:
> I did Gdk.Threads.Init() before Application.Init. Is that correct?
> 
> More importantly (since you don't recommend the first approach), how 
> would you go about using sockets asychronously? I don't see a 
> Gdk.Input.Add and even if I did it wouldn't take Socket.BeginConnect() 
> would it?
> 
> Matt
> 
> Todd Berman wrote:
> 
> >You have to be doing Gdk.Threads.Init () for Enter and Leave to be
> >working.
> >
> >On the whole, I do *not* recommend using that however, as it has its own
> >issues. Look at using Gtk.ThreadNotify.
> >
> >--Todd
> >
> >On Thu, 2004-08-04 at 14:36 -0400, Matt Eaton wrote:
> >  
> >
> >>I'm porting a windows.forms application to gtk and I'm having some 
> >>problems. I use AsyncCallback's for the network traffic. E.g. connecting 
> >>etc.
> >>
> >>The problem is that the GUI no longer paints after an asynccallback is run.
> >>
> >>I've placed Gdk.Threads.Enter() and Gdk.Threads.Leave() around sections 
> >>of code that interact with Gtk but it doesn't help.
> >>
> >>Any ideas?
> >>
> >>Thanks,
> >>Matt
> >>
> >>_______________________________________________
> >>Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> >>http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >>    
> >>
> >
> >_______________________________________________
> >Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> >http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
> >  
> >
> 
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list