"Luís Oliveira" <[EMAIL PROTECTED]> writes:

> On 04/02/07, Marco Gidde <[EMAIL PROTECTED]> wrote:
>> While this code isn't as short and elegant as the original code, at
>> least it works ;-)
>
> Indeed it does. It passes the trivial-garbage tests without crashing. Thanks!
>
> Anyway, I didn't feel like changing and testing the finalization code
> in both CFFI and trivial-garbage (what was I thinking?) so I just
> wiped out CFFI's finalization code. People can use trivial-garbage if
> they're interested in portable finalizers:
> <http://cliki.net/trivial-garbage>

While I would like to see the finalizer code in CFFI because I never
felt like using them in another context, it is certainly better to
keep the code consistent in only one place.

And for that matter: when ECL is compiled with the boehm garbage
collector (is it even possible without?) the following code should
work a bit better than the simple ERROR :-):


(defun finalize (object function)
  #-boehm-gc (error "ECLli does not support finalizers.")
  #+boehm-gc
  (let ((old-finalizer (si:get-finalizer object)))
    (si:set-finalizer object
                      (if old-finalizer
                          (lambda (obj)
                            (funcall function)
                            (funcall old-finalizer obj))
                          (lambda (obj)
                            (funcall function))))))

(defun cancel-finalization (object)
  #-boehm-gc (error "ECLli does not support finalizers.")
  #+boehm-gc (si:set-finalizer object nil))


Just noticed that there is no ECL specific code in trivial-garbage.
Any ideas where this code should be placed now?


Regards,

Marco
_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to