fix problem with continuations and `call-in-nested-thread'

Closes PR 12705

Merge to 5.3
This commit is contained in:
Matthew Flatt 2012-04-16 13:33:50 -06:00
parent 38e628be80
commit 1bcf56f5e9
4 changed files with 38 additions and 1 deletions

View File

@ -602,4 +602,15 @@
r1)
(test #t equal? r1 r2))
;; ----------------------------------------
;; Backup test for one in "thread.rktl", since this sandbox test
;; originally exposed it:
(let ()
(define sandbox (make-evaluator 'racket/base))
(sandbox "(define result (call/cc (lambda (x) (lambda () (x 5)))))")
(sandbox "(if (procedure? result) (result) result)"))
;; ----------------------------------------
(report-errs)

View File

@ -531,6 +531,27 @@
(arity-test call-in-nested-thread 1 2)
(test
7
'nested-thread-stack-ownership-test
(let ()
(define -k #f)
(call-in-nested-thread (lambda ()
(call-with-continuation-barrier
(lambda ()
(call-with-continuation-prompt
(lambda ()
(with-continuation-mark
'x
'y
(let/cc k
(set! -k k)
(sync (thread (lambda () (k 5))))))))))))
(call-in-nested-thread (lambda ()
(call-with-continuation-prompt
(lambda ()
(-k 7)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Test wait-multiple:

View File

@ -4729,7 +4729,7 @@ static Scheme_Cont *grab_continuation(Scheme_Thread *p, int for_prompt, int comp
p->runstack_owner = owner;
*owner = p;
}
if (p->cont_mark_stack && !p->cont_mark_stack_owner) {
if (cont->ss.cont_mark_stack && !p->cont_mark_stack_owner) {
Scheme_Thread **owner;
owner = MALLOC_N(Scheme_Thread *, 1);
p->cont_mark_stack_owner = owner;

View File

@ -3343,6 +3343,11 @@ Scheme_Object *scheme_call_as_nested_thread(int argc, Scheme_Object *argv[], voi
unschedule_in_set((Scheme_Object *)np, np->t_set_parent);
if (np->cont_mark_stack_owner
&& ((*np->cont_mark_stack_owner) == np)) {
*np->cont_mark_stack_owner = NULL;
}
np->running = 0;
*p->runstack_owner = p;