Am Samstag, 6. August 2016 21:30:53 UTC+9 schrieb Alex Miller:
>
> I think this is solution is fine. A single channel is not going to use any 
> noticeable resources. You've basically created a latch - there are several 
> latch-like things built into Java you can use as well. 
>
> In the main thread you could do:
> (let [signal (java.util.concurrent.CountDownLatch. 1)]
>   ... launch your work
>   (.await signal))
>
> And in the signal handler you then:
> (.countdown signal)
>
> You could also use a Lock and Condition (the oo version of wait/notify), 
> or a Semaphore, or a CyclicBarrier.
>
 
Ah, thanks! This might make the intention clearer.

Aside from that, I was more concerned with the resources allocated to the 
blocked main thread than to the channel. Although I guess a "main thread 
doing nothing for most of the application's lifetime" just sounds wrong, 
but actually doesn't matter.

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to