avoid shared mutation of break state across with-handlers procs

svn: r12706
This commit is contained in:
Matthew Flatt 2008-12-04 23:04:33 +00:00
parent e1126a66ed
commit 66a0c27703

View File

@ -168,18 +168,23 @@
(check-for-break)))
(define (select-handler/no-breaks e bpz l)
(cond
[(null? l)
(raise e)]
[((caar l) e)
(begin0
((cdar l) e)
(with-continuation-mark
break-enabled-key
bpz
(check-for-break)))]
[else
(select-handler/no-breaks e bpz (cdr l))]))
(with-continuation-mark
break-enabled-key
;; make a fresh thread cell so that the shared one isn't mutated
(make-thread-cell #f)
(let loop ([l l])
(cond
[(null? l)
(raise e)]
[((caar l) e)
(begin0
((cdar l) e)
(with-continuation-mark
break-enabled-key
bpz
(check-for-break)))]
[else
(loop (cdr l))]))))
(define (select-handler/breaks-as-is e bpz l)
(cond