From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Marius Vollmer Newsgroups: gmane.lisp.guile.user Subject: Re: Integrating guile into an existing multi-threaded application Date: 06 Jun 2002 01:24:09 +0200 Sender: guile-user-admin@gnu.org Message-ID: <878z5tgvhi.fsf@zagadka.ping.de> References: <20020605055317.12707.qmail@web12502.mail.yahoo.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1023319975 5688 127.0.0.1 (5 Jun 2002 23:32:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 5 Jun 2002 23:32:55 +0000 (UTC) Cc: guile-user@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17FkGp-0001TN-00 for ; Thu, 06 Jun 2002 01:32:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17FkBG-0006ON-00; Wed, 05 Jun 2002 19:27:06 -0400 Original-Received: from dialin.speedway42.dip7.dokom.de ([195.138.42.7] helo=zagadka.ping.de) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17Fk8a-0006Cs-00 for ; Wed, 05 Jun 2002 19:24:21 -0400 Original-Received: (qmail 1122 invoked by uid 1000); 5 Jun 2002 23:24:09 -0000 Original-To: Charlie Root In-Reply-To: <20020605055317.12707.qmail@web12502.mail.yahoo.com> Original-Lines: 47 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:549 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:549 Charlie Root writes: > . The guile interpreter may not be fired up by the process's > main thread, but some other one, and at some other time than > the end of main(). Is this a problem? Probably not. You should be using scm_boot_guile instead of scm_init_guile, tho, since the latter might not be able to find the correct stack base in non-main thread. scm_boot_guile uses the address of a local variable as the stack base. A consequence is that the callback given to scm_boot_guile should never return since scm_boot_guile will terminate the process then. (See below why I don't talk about gh_enter here.) > . I don't understand the arguments to gh_enter(). The main > thread's argc and argv will not be available to > gh_enter(). If the `inner_main' of gh_enter() is not going > to need data passed to it, can these contain dummy values? Use scm_boot_guile instead of gh_enter since the gh_ interface will eventually go away. We will make the scm_ API easy enough to use instead. It is reasonably easy already, I hope. scm_boot_guile has the same argc and argv arguments as gh_enter. >From the manual: `scm_boot_guile' arranges for the Scheme `command-line' function to return the strings given by ARGC and ARGV. If MAIN_FUNC modifies ARGC or ARGV, it should call `scm_set_program_arguments' with the final list, so Scheme code will know which arguments have been processed. So, you can pass any valid value. scm_boot_guile (0, NULL, ...) should be fine. This will make 'command-line' return the empty list. > . Will I be able to use guile's threads inside a system such as > the one described (that is, inside a non-main thread) ? Yes, I think so although I myself have never done it. > . Are there other obvious-to-the-seasoned-guiler sorts of issues > that I'd do better with if I knew of in advance? Be careful to always protect your global SCM values and to unprotect them when they die. And, try to use scm_ instead of gh_ functions. If you find you can't do that, yell. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user