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 shutdown: http://stackoverflow.com/a/1250655/22992 On Saturday, August 6, 2016 at 5:38:24 AM UTC+1, Richard Möhn wrote: > > I'm using core.async. In my application the main thread creates a few > channels, starts a few go blocks and that's it. When I run it as a > stand-alone (i.e. not in the REPL), it starts those go blocks and then > exits. After being surprised initially, I understand why this happens: the > main thread has nothing more to do, so it terminates and with it the > application. > > However, I want the application to run until it receives SIGTERM, for > example. My current solution is to have a channel wait-for-exit and the > main thread does a > (<!! wait-for-exit) > after starting its go routines and the signal handler does a > (put! wait-for-exit :ok) > This blocks the main thread until the signal handler is called and the > application shut down. > > It also wastes the resources allocated to the main thread. (Which is only > a little bit of RAM, as far as I know, so not too bad.) What is the usual > way to solve this problem? Let the main thread do the work of one of the go > routines? > > Best, > > Richard > -- 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.