So I'm tempted to ask at this point, what does your program do? If you're doing nothing but CPU work, then yeah you may need to do something in the main thread. However, all IO work should be done outside of go block. Go blocks are limited in the number of concurrent threads that they use, so it's possible to deadlock the pool if you do IO inside the code called by a go block. So I'd suggest moving what ever IO work you're doing into dedicated threads and that might just solve your problem.
On Sun, Aug 7, 2016 at 9:48 PM, Richard Möhn <richard.mo...@posteo.de> wrote: > > > 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. > -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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.