[racket-dev] FrTime propagation bug
Hi Marijn,
The value-now/sync procedure waits for propagation to complete before
reading a signal's value. Would something like the following suit your
purposes?
(define a (event-receiver))
(define b (event-receiver))
(define a+b (+ (hold a) (hold b)))
(send-event a 3)
(send-event b 5)
(value-now/sync a+b) ; read a+b after propagation => 8
Or, even simpler:
(define c (new-cell))
(define d (new-cell))
(define c+d (+ c d))
(set-cell! c 3)
(set-cell! d 5)
(value-now/sync c+d)
Greg
On Thu, Jan 12, 2012 at 12:49 AM, Marijn <hkBst at gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 11-01-12 21:26, Gregory Cooper wrote:
> > Hi Marijn,
> >
> > FrTime propagates changes asynchronously. When send-event returns,
> > there's no guarantee that the event has finished propagating
> > through the system. And in general, (value-now b) is not
> > well-defined, since asynchronous processing makes it difficult to
> > define what "now" means; programs should only call this if they can
> > tolerate stale values.
>
> Hi Gregory, so just to make sure I understand the implications of
> this: there is no way to do something like the following:
>
>
> #lang racket
>
> (require frtime)
>
> (define a (event-receiver))
> (define b (event-receiver))
>
> (define a+b (... ??? (merge-e a b)))
>
> (send-event a 3)
> (send-event b 5)
>
> (... ??? make sure everything is consistent again)
>
> (... ??? get the value 8 out of a+b)
>
>
> Marijn
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.18 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk8OnpkACgkQp/VmCx0OL2z8tACffv+uhmEAttZ7YhZ4UStbQR6p
> bFIAn3KOoI5uxWU+5hbWHxxJLgih8l7M
> =0Y03
> -----END PGP SIGNATURE-----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120112/7fcc2d2d/attachment.html>