[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] dangerous code when running finalizers
From: |
F. Wittenberger |
Subject: |
[Chicken-users] dangerous code when running finalizers |
Date: |
Mon, 08 Sep 2008 17:33:03 +0200 |
Hi,
I managed to have a finalizer raise an exception. This ran into a tight
loop in ##sys#force-finalizers. This patch will ignore them.
/Jörg
Index: library.scm
===================================================================
@@ -4250,6 +4257,7 @@
(define ##sys#run-pending-finalizers
(let ([vector-fill! vector-fill!]
[print print]
+ [with-exception-handler with-exception-handler]
[working #f] )
(lambda (state)
(unless working
@@ -4262,8 +4270,13 @@
(do ([i 0 (fx+ i 1)])
((fx>= i c))
(let ([i2 (fx+ 1 (fx* i 2))])
- ((##sys#slot ##sys#pending-finalizers (fx+ i2 1))
- (##sys#slot ##sys#pending-finalizers i2)) ) )
+ (##sys#call-with-current-continuation
+ (lambda (ret)
+ (with-exception-handler
+ ret
+ (lambda ()
+ ((##sys#slot ##sys#pending-finalizers (fx+ i2 1))
+ (##sys#slot ##sys#pending-finalizers i2)))))) ) )
(vector-fill! ##sys#pending-finalizers (##core#undefined))
(##sys#setislot ##sys#pending-finalizers 0 0)
(set! working #f) ) )
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Chicken-users] dangerous code when running finalizers,
F. Wittenberger <=