chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] egg announcement: remote-repl


From: Graham Fawcett
Subject: Re: [Chicken-users] egg announcement: remote-repl
Date: Tue, 19 Aug 2008 10:02:20 -0400

On Tue, Aug 19, 2008 at 9:36 AM, Tobia Conforto <address@hidden> 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
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users
>




reply via email to

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