[prev in list] [next in list] [prev in thread] [next in thread] 

List:       racket-dev
Subject:    [racket-dev] engine-kill from racket/engine
From:       mflatt () cs ! utah ! edu (Matthew Flatt)
Date:       2013-06-25 9:02:42
Message-ID: 20130625090246.2A0EE6500B9 () mail-svr1 ! cs ! utah ! edu
[Download RAW message or body]

I think that has to be a bug, and so a repair would be welcome.

At Tue, 25 Jun 2013 01:44:11 -0400, Asumu Takikawa wrote:
> Hi all,
> 
> I was trying to write an example for the racket/engine docs and stumbled
> on a case that seems to cause a deadlock. I'm curious if this is
> intentional or just accidental behavior.
> 
> Here's the example:
> 
>   #lang racket
>   (require racket/engine)
>   (define e (engine (lambda (s) (sleep 5))))
>   (thread (lambda () (sleep 2) (engine-kill e)))
>   (engine-run never-evt e)
> 
> This will never terminate. If you comment out the fourth line, it will
> terminate. If you change `never-evt` to 4000 (or any other event that
> will become ready), it's also fine.
> 
> What seems to be going on is that `engine-kill` does actually kill the
> thread underlying the engine. However, `engine-run` is `sync`ed on (1)
> the given event (2) the engine being "done" or (3) an exception being
> raised.  Since `engine-kill` does not trigger any of those, the `sync`
> is blocked.
> 
> Cheers,
> Asumu
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic