Marc,
Is there an outer extent on wills' applicability - why don't the second two gsc runs say OUT on termination?
Thanks, Adam
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
(##gc) (set! a #f) (##gc)
OUT.
,q
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$ gsc
(make-will (box 1) (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$
Afficher les réponses par date
Will executability is determined by the garbage collector. When the Gambit process terminates the garbage collector is not called because this would take time and it is generally useless (the whole heap is reclaimed at once).
So if you insist on the will executors to be called at the end of the program’s execution, you should call ##gc explicitly. Note however that you may need to call ##gc more than once because a will’s executability may depend on the execution of another will. So you’ll have to program the logic for this loop.
Marc
On Dec 18, 2015, at 6:49 AM, Adam adam.mlmb@gmail.com wrote:
Marc,
Is there an outer extent on wills' applicability - why don't the second two gsc runs say OUT on termination?
Thanks, Adam
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
(##gc) (set! a #f) (##gc)
OUT.
,q
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$ gsc
(make-will (box 1) (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$
Ah, that's a valuable distinction.
FFI types have their release function called though, right?
Anyhow if any kind of cleanup is needed on termination (as in ,q etc.) I think there's some kind of termination handler in the manual so just use that then - thanks!
2015-12-18 23:11 GMT+08:00 Marc Feeley feeley@iro.umontreal.ca:
Will executability is determined by the garbage collector. When the Gambit process terminates the garbage collector is not called because this would take time and it is generally useless (the whole heap is reclaimed at once).
So if you insist on the will executors to be called at the end of the program’s execution, you should call ##gc explicitly. Note however that you may need to call ##gc more than once because a will’s executability may depend on the execution of another will. So you’ll have to program the logic for this loop.
Marc
On Dec 18, 2015, at 6:49 AM, Adam adam.mlmb@gmail.com wrote:
Marc,
Is there an outer extent on wills' applicability - why don't the second
two gsc runs say OUT on termination?
Thanks, Adam
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
(##gc) (set! a #f) (##gc)
OUT.
,q
$ gsc
(define a (box 1)) (make-will a (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$ gsc
(make-will (box 1) (lambda (v) (print "OUT.\n") (force-output)))
#<will #2>
,q
$