[Top][All Lists]

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

Re: The equivalent of racket's break-thread in guile?

From: Nala Ginrut
Subject: Re: The equivalent of racket's break-thread in guile?
Date: Fri, 31 May 2013 11:59:57 +0800

On Fri, 2013-05-31 at 07:40 +0800, Xin Wang wrote:
> In Racket, break-thread is used to send an break exception to a thread[1].
> E. g.
> (let ((th (thread (lambda ()
>             (dynamic-wind
>               (lambda () #t)
>               (lambda () (/ 1 0))
>               (lambda () (sleep 5) (display "out-guard\n")))))))
>   (sleep 1)
>   (break-thread th))
> For above code, out-guard part of dynmaic-wind will not be interrupted if
> use break-thread to cancel a thread, and kill-thread will cancel thread
> immediately.
> In Guile, the equivalent of kill-thread is cancel-thread, and is there any
> equivalent of break-thread?
> [1]

I think the answer is NO.

The thread in Racket is green-thread which is implemented by some kind
of stack-copying. That's why its thread could receive the so-called
'break signal'. The scheduler is in the VM rather than OS.
But the traditional thread in Guile is based on pthread. So they are
very different. 
Anyway, I'm trying to write green-thread based on delimited-continuation
which will be used for an Actor-model implementation.

> Regards,
> Xin Wang

reply via email to

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