[racket-dev] TR tests sometimes fail with a promise error

From: Eli Barzilay (eli at barzilay.org)
Date: Fri May 3 12:17:46 EDT 2013

A few minutes ago, Vincent St-Amour wrote:
> At Fri, 3 May 2013 11:56:02 -0400, Eli Barzilay wrote:
> >     (define (delay/thread thunk)
> >       (let ()
> >         (define p (make-promise/thread #f))
> >         (pset! p (make-running-thread (thread (λ() ...same...))))
> >         p))
> I think that introduces another race condition.
> If the thread is forced before the `pset!', then `force' would
> return #f (line 107 of racket/promise.rkt), since the value inside
> the `promise/thread' is not a thread.

But this can't happen because `delay/thread' won't return with the
broken promise until after the `pset!' fixed it.

(Even code in the input thunk will not be able to try to force itself
without having itself accessible as a value.)

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.