Hacker News new | ask | show | jobs
by xaritas 4657 days ago
> Using Thread/sleep inside of a go block is questionable. Using >!! and <!! inside a go block is simply wrong.

They both block the thread and any other go-blocks that happen to be mapped to it. I think you get 2 x NUM_CPU threads in the dedicated pool for channels, so either of these is a mistake. (Aside: I'm not sure why you were down voted for saying this.)

When you need to wait inside of a go-block, the correct way is to use (timeout millis), which creates and then closes a channel.

This has some nice examples: https://github.com/clojure/core.async/blob/master/examples/w...