This is the mail archive of the
guile@cygnus.com
mailing list for the Guile project.
Re: The taming of the before-gc-hook (was Re: Upcoming 1.3.2 release)
Greg Harvey <Greg.Harvey@thezone.net> writes:
> hjstein@bfr.co.il (Harvey J. Stein) writes:
>
> > Why is a C function on scm_before_gc_hook any safer than a Scheme
> > function? The C function can just as easily call guile functions
> > which require space to be grabbed.
>
> Yes, but the c function isn't going to use any allocation unless you
> tell it to (assuming that the evaluator won't do any consing, for the
> (whatever)subr0(whatever) types ); you can't make the same guarantee
> about a scheme function.
If the evaluator doesn't do any consing then the same scheme fcns are
as safe from Scheme as they are from C. I don't see why saying "You
can only use the following fcns in the scm_before_gc_hook" is any
better for C code than for Scheme code. So, I don't see why it'd be
considered OK to supply a C hook but not a Scheme hook.
--
Harvey J. Stein
Bloomberg LP
hjstein@bfr.co.il