I learn to use Threading in Gtk, and it is really easy: If it help, read it from my project svn page:
This is where i call the thread start http://gcomandos.svn.sourceforge.net/viewvc/gcomandos/trunk/gComandos/gComandos/ui/windows/CopyFile.cs?revision=81&view=markup This is the method called: http://gcomandos.svn.sourceforge.net/viewvc/gcomandos/trunk/gComandos/gComandos/fs/XferOperation.cs?revision=68&view=markup I use an object to get all the info about the second thread, it has a constructor with all the info needed in the second thread (you cannot pass parameters to new ThreadStart(method)). I pass callback to return to previous thread, and i use Gtk.Application.Invoke to change the Gtk Thread. You can even see a code with Monitor and Lock too: http://gcomandos.svn.sourceforge.net/viewvc/gcomandos/trunk/gComandos/gComandos/ui/windows/DeleteFile.cs?revision=81&view=markup I hope it helps. Luciano >From: Walter Kempf <[EMAIL PROTECTED]> >To: Aaron Oxford <[EMAIL PROTECTED]> >CC: [email protected] >Subject: Re: [Gtk-sharp-list] Table layout and cross-thread calling >Date: Tue, 13 Mar 2007 07:45:49 +0200 >MIME-Version: 1.0 >Received: from lists.ximian.com ([130.57.169.22]) by >bay0-mc1-f18.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2668); Mon, >12 Mar 2007 23:04:58 -0700 >Received: from galactus.ximian.com (localhost.localdomain [127.0.0.1])by >lists.ximian.com (Postfix) with ESMTP id 2F6711CFC51;Tue, 13 Mar 2007 >03:43:53 -0400 (EDT) >Received: from herald.ximian.com (frontgate.ximian.com [130.57.169.19])by >lists.ximian.com (Postfix) with ESMTP id 019B71CFC06for ><[email protected]>;Tue, 13 Mar 2007 03:43:51 -0400 (EDT) >Received: by herald.ximian.com (Postfix, from userid 2601)id EE71B70039; >Tue, 13 Mar 2007 01:04:55 -0500 (EST) >Received: from www26a.your-server.co.za >(www26a.your-server.co.za[196.7.147.26])by herald.ximian.com (Postfix) with >ESMTP id C0BE870035for <[email protected]>;Tue, 13 Mar 2007 >01:04:51 -0500 (EST) >Received: from c1-212-1.tbnb.isadsl.co.za >([196.209.64.212]helo=[192.168.0.202])by www26a.your-server.co.za with >esmtpa (Exim 4.63)(envelope-from <[EMAIL PROTECTED]>)id >1HQzog-0008JU-FR; Tue, 13 Mar 2007 07:44:58 +0200 >X-Message-Info: >LsUYwwHHNt3iFk6gYef752fLkj1InBzdd1X8E4rxUk+SzqWjxvcS2zoc2F5rb4kC >X-Original-To: [email protected] >Delivered-To: [email protected] >X-Greylist: delayed 1183 seconds by postgrey-1.27 at >frontgate.ximian.com;Tue, 13 Mar 2007 01:04:51 EST >User-Agent: Thunderbird 1.5.0.10 (X11/20070221) >References: ><[EMAIL PROTECTED]> >X-Authenticated-Sender: [EMAIL PROTECTED] >X-Virus-Scanned: Clear (ClamAV 0.88.4/2830/Tue Mar 13 07:12:22 2007) >X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on >frontgate.ximian.com >X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=MY_OBFUX >version=3.0.3 >X-BeenThere: [email protected] >X-Mailman-Version: 2.1.8 >Precedence: list >List-Id: "Discussion of the .Net bindings for >Gnome"<gtk-sharp-list.lists.ximian.com> >List-Unsubscribe: ><http://lists.ximian.com/mailman/listinfo/gtk-sharp-list>,<mailto:[EMAIL >PROTECTED]> >List-Archive: <http://lists.ximian.com/pipermail/gtk-sharp-list> >List-Post: <mailto:[email protected]> >List-Help: <mailto:[EMAIL PROTECTED]> >List-Subscribe: ><http://lists.ximian.com/mailman/listinfo/gtk-sharp-list>,<mailto:[EMAIL >PROTECTED]> >Errors-To: [EMAIL PROTECTED] >Return-Path: [EMAIL PROTECTED] >X-OriginalArrivalTime: 13 Mar 2007 06:04:59.0074 (UTC) >FILETIME=[87E1C220:01C76535] > >Hi, > >Seeing as I've dabbed in multi-threading myself (albeit not with that >much success), I can point you to >http://www.mono-project.com/Responsive_Applications. > >If you search through the various threading issues described previously >in this list, it seems that the Gtk.Application.Invoke(delegate {...}) >path is the most favored (also covered in the "Responsive Applications" >article). > >Hope this helps, > >Walter > >Aaron Oxford wrote: > > Hi all, > > > > I'm still making great progress with my app, but I've found another >couple of things that are > > confusing me. > > > > First and foremost, I seem to be getting extremely strange behaviour >modifying a label from > > another thread. The code crashes more often than not. This is unusual >for a threading problem > > because generally the chances of a problem occurring are very small. In >any case, what is the > > accepted method for modifying Widgets from other threads? > > > > Also, the table layout seems to be playing up very badly. I declare an >Nx3 table and fill it up > > with components but they all appear on top of each other, no matter what >I do with packing, size > > hints or Show vs ShowAll. I'm struggling a lot with this completely >uncontrollable layout > > philosophy - is there really no way to control the relative proportions >of components as they > > scale? It seems that if I create two thin columns and one fat one, >stretching the window leaves me > > with three columns of equal width. > > > > Apologies for posting even more newbie questions, thanks in advance for >any help. > > > > >_______________________________________________ >Gtk-sharp-list maillist - [email protected] >http://lists.ximian.com/mailman/listinfo/gtk-sharp-list _________________________________________________________________ MSN Latino: el sitio MSN para los hispanos en EE.UU. http://latino.msn.com/ _______________________________________________ Gtk-sharp-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/gtk-sharp-list
