fix a bug related to the implicit prompt in a thread taking over the role of an explicit prompt

svn: r5887
This commit is contained in:
Matthew Flatt 2007-04-08 08:57:58 +00:00
parent 12730df706
commit 555e5376a3
2 changed files with 22 additions and 1 deletions

View File

@ -1667,6 +1667,27 @@
(test '(1 2 3 4 5 1 2 3 4 5 1 6 6 2 3 4 5 1 6 6) go (default-continuation-prompt-tag) #f) (test '(1 2 3 4 5 1 2 3 4 5 1 6 6 2 3 4 5 1 6 6) go (default-continuation-prompt-tag) #f)
(test '(1 2 3 4 5 1 2 3 4 5 1 6 6 2 3 4 5 1 6 6) go (make-continuation-prompt-tag) #f)) (test '(1 2 3 4 5 1 2 3 4 5 1 6 6 2 3 4 5 1 6 6) go (make-continuation-prompt-tag) #f))
;; ----------------------------------------
;; Run two levels of continuations where an explicit
;; prompt in a capturing thread is represented by an
;; implicit prompt in the calling thread.
(let ()
(define (foo thunk)
(call-with-continuation-prompt
(lambda ()
(let/cc ret
(let ([run? #f])
(let/cc run
(thread (lambda ()
(sync (system-idle-evt))
(set! run? #t)
(run))))
(when run? (ret (thunk))))))))
(define s (make-semaphore))
(foo (lambda () (semaphore-post s)))
(test s sync s))
;; ---------------------------------------- ;; ----------------------------------------
;; Try long chain of composable continuations ;; Try long chain of composable continuations

View File

@ -5961,7 +5961,7 @@ Scheme_Object *scheme_jump_to_continuation(Scheme_Object *obj, int num_rands, Sc
created with a new thread or a barrier prompt. */ created with a new thread or a barrier prompt. */
p->meta_continuation = NULL; /* since prompt wasn't in any meta-continuation */ p->meta_continuation = NULL; /* since prompt wasn't in any meta-continuation */
p->meta_prompt = NULL; p->meta_prompt = NULL;
if (c->barrier_prompt == barrier_prompt) { if ((c->barrier_prompt == barrier_prompt) && barrier_prompt) {
/* Barrier determines continuation end. */ /* Barrier determines continuation end. */
c->resume_to = NULL; c->resume_to = NULL;
p->stack_start = c->stack_start; p->stack_start = c->stack_start;