Re: Keep application running when main thread only starts go blocks

2016-08-08 Thread Richard Möhn
On Sun, Aug 07, 2016 at 10:21:44PM -0600, Timothy Baldridge wrote: > 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 > blo

Re: Keep application running when main thread only starts go blocks

2016-08-07 Thread Timothy Baldridge
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

Re: Keep application running when main thread only starts go blocks

2016-08-07 Thread Richard Möhn
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 th

Re: Keep application running when main thread only starts go blocks

2016-08-07 Thread Richard Möhn
Am Samstag, 6. August 2016 16:50:35 UTC+9 schrieb Miguel Ping: > > Dunno about clojure, but in javaland you would submit jobs through an > executor and then wait for all tasks on the executor to finish, blocking > the main thread. > > A bit of googling, and you can alter the core.async executor

Re: Keep application running when main thread only starts go blocks

2016-08-06 Thread 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)]

Re: Keep application running when main thread only starts go blocks

2016-08-06 Thread Miguel Ping
Dunno about clojure, but in javaland you would submit jobs through an executor and then wait for all tasks on the executor to finish, blocking the main thread. A bit of googling, and you can alter the core.async executor: http://stackoverflow.com/a/18779688/22992 And then you can await for its