unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Marius Vollmer <mvo@zagadka.de>
Subject: Re: doco scm_remember_upto_1
Date: 19 Jun 2003 01:36:10 +0200	[thread overview]
Message-ID: <87adcf0xhx.fsf@zagadka.ping.de> (raw)
In-Reply-To: <877k7snrg5.fsf@zip.com.au>

Kevin Ryde <user42@zip.com.au> writes:

>    In a multi-threaded program, the rule is the same.  As far as a
>    given thread is concerned, a garbage collect still only occurs
>    within a memory allocation function, not at an arbitrary time.
>    (Guile waits for all threads to reach a memory function, and holds
>    them there while the collector runs.)

Don't say "memory allocation function", that is too specific.  A GC
can occur in any libguile function, since all of them might eventually
allocate memory or run a async that does so, or simply invoke SCM_TICK
which is also a safe point for stopping a thread.

> >     But when in doubt, be
> >     conservative: include the call to scm_remember_upto_here_1 when
> >     you are not sure that it is safe to leave it out.
> 
> I think I'd rather see something unambiguous said about when a
> remember must be used, instead of talking about being unsure.  I tried
> to reword a little to emphasise it's memory activity which provokes a
> gc.

Hmm, the most concrete I can think of is:

  If there is a call to any libguile function after you have extracted
  the innards of some SCM object (from a smob, or with
  SCM_STRING_CHARS, etc.) you can't count on that innard still being
  there unless the associated SCM is used again later on (and that use
  is not being optimized away), if only by virtue of appearing in a
  call to scm_remember_upto_here.

The "doubt" would come when one isn't sure whether a libguile function
is being called because one doesn't know what kind of stuff third
party functions do.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2003-06-18 23:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-21 23:15 doco scm_remember_upto_1 Kevin Ryde
2003-05-22  7:07 ` Rob Browning
2003-05-22  9:42   ` Marius Vollmer
2003-05-22 15:21     ` Rob Browning
2003-05-24  1:19       ` Kevin Ryde
2003-05-30  0:04         ` Kevin Ryde
2003-06-01 21:41           ` Marius Vollmer
2003-06-11 23:07             ` Kevin Ryde
2003-06-18 23:36               ` Marius Vollmer [this message]
2003-06-21 23:02                 ` Kevin Ryde
2003-07-27 14:49                   ` Marius Vollmer
2003-05-30 13:26       ` Marius Vollmer

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=87adcf0xhx.fsf@zagadka.ping.de \
    --to=mvo@zagadka.de \
    /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).