[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scm_init_guile when null threads

From: Oleg Parashchenko
Subject: Re: scm_init_guile when null threads
Date: Sun, 2 Apr 2006 19:29:23 +0400

Hello Ken,

On Sun, 2 Apr 2006 00:50:20 -0500
Ken Raeburn <address@hidden> wrote:

> 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.)

Thank you for explaining the interface.

> 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.

I have two questions about scm_with_guile related to initialization and

I have impression that before using Guile, one has to initialize Guile
using scm_init_gsubr(), scm_init_procprop() etc, but scm_with_guile
doesn't do it. Am I wrong?

Now about nesting. Let's suppose my program switches to Guile using
scm_with_guile (stack base "A"). Guile runs, at some moments executes
an extension function, and switches back to the program. The code needs
some Guile and calls scm_with_guile again (stack base "B"). The question:
does garbage collector work correctly, not missing the Scheme values
between "A" and "B"?

> Ken

Oleg Parashchenko  olpa@  XML news in Russian  Generative Programming, XML, TeX, Scheme

reply via email to

[Prev in Thread] Current Thread [Next in Thread]