On Tue, Aug 19, 2008 at 9:36 AM, Tobia Conforto <[EMAIL PROTECTED]> wrote:
> Jörg F. Wittenberger wrote:
>>
>> are dynamic-wind pre/post-thunks by chicken executed upon each thread
>> switch?
>
> Why would they?

It's not a bad question. When threads are implemented using
continuations, it is reasonable to expect dynamic-wind to be triggered
in a context switch. I don't have references at hand, but I've read an
academic paper or two on this issue.

>
> In fact they don't:

And thankfully so!
Graham


>
> ------------------------------------------------------------
> (use srfi-18)
>
> (thread-start!
>  (make-thread
>    (lambda ()
>      (dynamic-wind
>        (lambda ()
>          (print "Entering thread 1"))
>        (lambda ()
>          (print "In thread 1")
>          (thread-yield!)
>          (print "In thread 1"))
>        (lambda ()
>          (print "Exiting thread 1"))))))
>
> (dynamic-wind
>  (lambda ()
>    (print "Entering thread 0"))
>  (lambda ()
>    (print "In thread 0")
>    (thread-yield!)
>    (print "In thread 0"))
>  (lambda ()
>    (print "Exiting thread 0")))
>
> (thread-sleep! 1)
> ------------------------------------------------------------
>
>
> Entering thread 0
> In thread 0
> Entering thread 1
> In thread 1
> In thread 0
> Exiting thread 0
> In thread 1
> Exiting thread 1
>
>
> Tobia
>
> _______________________________________________
> Chicken-users mailing list
> Chicken-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to