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

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Fri May 3 13:20:59 EDT 2013

I tried your suggestion, and it doesn't fix the original bug.

I'll stick with the semaphores solution.

Vincent



At Fri, 03 May 2013 13:13:45 -0400,
Vincent St-Amour wrote:
> 
> At Fri, 3 May 2013 12:17:46 -0400,
> Eli Barzilay wrote:
> > 
> > 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.)
> 
> Makes sense. I'll give it a try.
> 
> Vincent


Posted on the dev mailing list.