At Tue, 29 Mar 2011 08:46:06 -0400, Sam Tobin-Hochstadt wrote:
> I just meant that
> 
> (sync (future (lambda () ...)))
> 
> should be the same as
> 
> (touch (future (lambda () ...)))
> 
> or is that hard for future-safety reasons as well?

I'm not convinced that it makes sense. When you create a future,
there's no guarantee that the future's thunk will run concurrently with
the main computation (i.e., a future may provide parallelism, but it's
not intended for concurrency). So, if you simply `sync' on the future's
completion, it won't necessarily ever complete, because no one is
necessarily demanding the result.

You can put concurrency and parallelism together like this, I suppose:

  (sync (thread (lambda () (touch (future ...)))))

In that case, there's a clear demand for a future's result, a sensible
synchronization between concurrent tasks, and an opportunity for
parallelism.

_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to