chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-janitors] #1127: dynamic wind in its own thread


From: Chicken Trac
Subject: [Chicken-janitors] #1127: dynamic wind in its own thread
Date: Thu, 22 May 2014 14:37:43 -0000

#1127: dynamic wind in its own thread
------------------------+---------------------------------------------------
 Reporter:  kristianlm  |       Owner:         
     Type:  defect      |      Status:  new    
 Priority:  major       |   Milestone:  someday
Component:  unknown     |     Version:  4.9.x  
 Keywords:              |  
------------------------+---------------------------------------------------
 I'm running this code in 4.9.0rc1:

 (define (trick)
   (dynamic-wind (lambda () (print "before"))
                 (lambda () (error 'foo))
                 (lambda () (print "after"))))

 ;; calls before and after, no surprises:
 (trick)

 ;; calls before only - why?
 (thread-start! (lambda () (trick)))

 ;; calls before and after, no surprises
 (thread-start!
  (lambda () (handle-exceptions e (raise e) (trick))))

 ;;; It outputs:
 before

 Error: foo

         Call history:

         <syntax>          (trick)
         <eval>    (trick)
         <eval>    [trick] (dynamic-wind (lambda () (print "before"))
 (lambda () (error (quote foo))) (lambda () (print "after"...
         <eval>    [trick] (print "before")
         <eval>    [trick] (error (quote foo))   <--
 after
 #<thread: thread22>
 before

 Warning (#<thread: thread22>): in thread: foo

         Call history:

         <eval>    (trick)
         <eval>    [trick] (dynamic-wind (lambda () (print "before"))
 (lambda () (error (quote foo))) (lambda () (print "after"...
         <eval>    [trick] (print "before")
         <eval>    [trick] (error (quote foo))   <--

 ;; I expect to see "after" printed on the second run too

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1127>
CHICKEN Scheme <http://www.call-with-current-continuation.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]