Jeff Rose <ros...@gmail.com> writes:

>Getting with a timeout versus without one is the difference of:
>
> ; blocking deref
> @p
>
> ; deref with 100ms timeout
> (.get (future @p) 100 TimeUnit/MILLISECONDS)

But the former just blocks on the promise being delivered, while the
latter creates an anonymous function, creates a proxy Future around it,
submits it for execution on a separate thread, and then blocks on the
function completing and (possibly) yielding a return value. That's much
more than a syntactic difference.

I tried to rewrite `promise' in terms of an AbstractQueuedSynchronizer
so that I could expose timed waits on it, but I got hung up with lack of
access to protected methods in the `proxy' macro.

-- 
Steven E. Harris

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to