Re: [racket-dev] engine-kill from racket/engine

2013-06-25 Thread Matthew Flatt
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
_
  Racket Developers list:
  http://lists.racket-lang.org/dev


[racket-dev] engine-kill from racket/engine

2013-06-24 Thread Asumu Takikawa
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