From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.devel Subject: Re: Killing off scm_init_guile for Guile 2.0 ? Date: Fri, 23 Jan 2009 02:02:15 +0000 Message-ID: <49dd78620901221802i36618f94qcc4bf56a89d32a46@mail.gmail.com> References: <49dd78620901151530o66a2641ax47e526d15fc09faf@mail.gmail.com> <20090116213215.YITDV.179685.root@cdptpa-web09-z02> <3ae3aa420901161736u5de528d5gc75da062fb036115@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1232676164 2160 80.91.229.12 (23 Jan 2009 02:02:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Jan 2009 02:02:44 +0000 (UTC) Cc: Guile User , guile-devel To: linasvepstas@gmail.com Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jan 23 03:03:56 2009 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LQBOl-0005P2-02 for guile-user@m.gmane.org; Fri, 23 Jan 2009 03:03:55 +0100 Original-Received: from localhost ([127.0.0.1]:57588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQBNT-00061J-Cp for guile-user@m.gmane.org; Thu, 22 Jan 2009 21:02:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQBND-0005zj-BD for guile-user@gnu.org; Thu, 22 Jan 2009 21:02:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQBND-0005zM-1V for guile-user@gnu.org; Thu, 22 Jan 2009 21:02:19 -0500 Original-Received: from [199.232.76.173] (port=47764 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQBNC-0005zH-S1; Thu, 22 Jan 2009 21:02:18 -0500 Original-Received: from fg-out-1718.google.com ([72.14.220.155]:49241) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LQBNC-0001Iz-6g; Thu, 22 Jan 2009 21:02:18 -0500 Original-Received: by fg-out-1718.google.com with SMTP id l26so2463242fgb.30 for ; Thu, 22 Jan 2009 18:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CxNjdqaVxpbNAoB2Qy/oruhPj42o4wx5YqNra13yE60=; b=PtyrggE7yChaIVFNOg6riK5vuVizdDVOITa4DPFTl5h4GfKjisSaveSU5agRqK+J9U N4qXq1R/31x1B0wJiQ3+NwXtCGk9+JoUysFoUnLMYaUKA67bR/b8rukExXzx3ehNnwnH qdb0scTWzmWmmUZdQdDM5NwceUBQZNRMsXfD4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=WtVkB0L2jU+cHeMVwqL3ROxO08ujhErCCUVlUVujGm5ABrk7JPQRKyJl+gYeU9MpIf oB53v4MTCeMsy6A2GDBZS15AJKiyr6nWGS5+130rasJppGlHTAZLlr4YsLjZVsJI6Q8l xf6suGmwj7Ov2tOUHZDz1ef8WL6vXlDatLV50= Original-Received: by 10.86.82.6 with SMTP id f6mr1366886fgb.42.1232676135951; Thu, 22 Jan 2009 18:02:15 -0800 (PST) In-Reply-To: <3ae3aa420901161736u5de528d5gc75da062fb036115@mail.gmail.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:7085 gmane.lisp.guile.devel:8064 Archived-At: 2009/1/17 Linas Vepstas : > 2009/1/16 : >> ---- Neil Jerram wrote: >>> scm_init_guile has always been a bit problematic, as it requires lots >>> of heuristic and OS-dependent code to try to determine where the base >>> of the stack is. It's never been formally deprecated, but we have >>> always advised people to use scm_boot_guile or scm_with_guile if they > >> Iirc, scm_init_guile is mainly used when you do not have access to main(), for example writing a module for apache. Generally, when you want to add Guile to an already existing application that has plugins or extension modules via .so's. > > This is an excellent example of where scm_init_guile > is exactly the *wrong* function to use. I would say that it's not definitely wrong, but it's certainly risky. The point is that "guile mode"-ness applies on a per-thread basis, so scm_init_guile (on its own) can only be correct if you are sure that the application is always going to execute your libguile-using code on the same thread (the one where you called scm_init_guile). > The problem is, > of course, that if you scm_init_guile in some .so, > you will accidentally place the entire system into guile > mode, and not just the .so, as intended. Or, to put that another way, the "guile mode"-ness persists on the thread that called your libguile-using code, even after the thread has returned back into the depths of the application. That might not be a problem, but it could be. For example, threads in guile mode are (currently; I'm not sure what BDW-GC will do) paused when a garbage collection is needed; so activity on another guile thread could suddenly block the application thread; or more likely the other way round: the GC would not be able to proceed, because the application thread would not actually pause. > Instead, you want to call scm_with_guile on entry to > the so, it will unwind on exit. > > This could be cleared up by having the docs make > the case more forcefully. Yes x 2. Neil