From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_init_guile when null threads Date: Sun, 2 Apr 2006 00:50:20 -0500 Message-ID: <85D0035F-4B28-472D-A275-7BF0950B5256@raeburn.org> References: <20060401092404.0176a77b.olpa@xmlhack.ru> <871wwhwtyh.fsf@ossau.uklinux.net> <20060402064812.1191cb0c.olpa@xmlhack.ru> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v746.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1143957036 24103 80.91.229.2 (2 Apr 2006 05:50:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 2 Apr 2006 05:50:36 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 02 07:50:35 2006 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FPvTs-0003vw-Ag for guile-devel@m.gmane.org; Sun, 02 Apr 2006 07:50:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FPvTr-0000C2-S7 for guile-devel@m.gmane.org; Sun, 02 Apr 2006 00:50:31 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FPvTm-0000Bs-UN for guile-devel@gnu.org; Sun, 02 Apr 2006 00:50:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FPvTk-0000BZ-WB for guile-devel@gnu.org; Sun, 02 Apr 2006 00:50:25 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FPvTk-0000BV-Rd for guile-devel@gnu.org; Sun, 02 Apr 2006 00:50:24 -0500 Original-Received: from [204.127.192.81] (helo=rwcrmhc11.comcast.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FPvWW-0001aB-Oj for guile-devel@gnu.org; Sun, 02 Apr 2006 00:53:16 -0500 Original-Received: from raeburn.org (c-65-96-168-237.hsd1.ma.comcast.net[65.96.168.237]) by comcast.net (rwcrmhc11) with ESMTP id <20060402055022m1100c64u9e>; Sun, 2 Apr 2006 05:50:23 +0000 Original-Received: from [18.101.0.231] (fwoosh.raeburn.org [18.101.0.231]) by raeburn.org (8.12.11/8.12.11) with ESMTP id k325oL8K004591; Sun, 2 Apr 2006 00:50:21 -0500 (EST) In-Reply-To: <20060402064812.1191cb0c.olpa@xmlhack.ru> Original-To: Oleg Parashchenko X-Mailer: Apple Mail (2.746.3) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5836 Archived-At: On Apr 1, 2006, at 21:48, Oleg Parashchenko wrote: > Neil Jerram wrote: >> Could you easily rework the program to use scm_boot_guile or >> scm_with_guile instead? > > No, scm_boot_guile doesn't return, and I can't guess what > scm_with_guile > does. But looking at sources, I found the function > scm_i_init_guile. This > might be exactly what I need, I'll try later. You call scm_with_guile, and give it a function to call that manipulates Guile objects or calls Guile functions; it causes the thread to enter "guile mode", calls the function, leaves "guile mode" and returns to the caller. (You can also pass a pointer to whatever associated data you want, so you don't have to make your function rely on global variables.) Since it controls entry and exit to your function, its ability to figure out where the "guile part" of the stack of that thread (needed for garbage collection) starts is much greater than with scm_init_guile. If you use scm_init_guile, it needs to figure out where the thread's stack's base is (yes, this may be easier on some platforms when configured for null threads), because under that interface, you could pop back up a few stack frames before invoking some Guile routines and storing objects into stack slots. Using scm_with_guile, your automatic variables with SCM objects won't get stored on the "wrong" side of the stack pointer that scm_with_guile has recorded. Ken _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel