unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
Cc: guile-devel@gnu.org
Subject: Re: scm_init_guile when null threads
Date: Sun, 2 Apr 2006 00:50:20 -0500	[thread overview]
Message-ID: <85D0035F-4B28-472D-A275-7BF0950B5256@raeburn.org> (raw)
In-Reply-To: <20060402064812.1191cb0c.olpa@xmlhack.ru>

On Apr 1, 2006, at 21:48, Oleg Parashchenko wrote:
> Neil Jerram <neil@ossau.uklinux.net> 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


  reply	other threads:[~2006-04-02  5:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-01  5:24 scm_init_guile when null threads Oleg Parashchenko
2006-04-01  9:01 ` Neil Jerram
2006-04-02  2:48   ` Oleg Parashchenko
2006-04-02  5:50     ` Ken Raeburn [this message]
2006-04-02 15:29       ` Oleg Parashchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85D0035F-4B28-472D-A275-7BF0950B5256@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).