> Since funccall may trigger a garbage collection, the value func in > your run procedure may not be valid, once a GC occurred. [...] > > Here is an alternative version: > > (use format) > > (define-external (funccall (scheme-object func)) void (func)) > > (define run > (foreign-callback-lambda* void ((long n) (scheme-object func)) > "void *r = CHICKEN_new_gc_root();" > "CHICKEN_gc_root_set(r, func);" > "while (n--) funccall(CHICKEN_gc_root_ref(r));" > "CHICKEN_delete_gc_root(r);") ) > > (run 1000000 (lambda () (format #t "~%")))
Excellent! I'll make sure I document this in our unofficial manual. :) Thank you, Felix! Alejo. http://bachue.com/alejo ---=( Comunidad de Usuarios de Software Libre en Colombia )=--- ---=( http://bachue.com/colibri )=--=( [EMAIL PROTECTED] )=--- _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
