Go's concurrency model on top of JRuby
Channel.new
creates a channel, and you can optionally pass it a capacity: Channel.new(200)
Use <<
to send on a channel: chan << "stuff"
Use ~
to receive from a channel: puts ~chan
Call go!
on a Proc or Method to start a new goroutine: lambda { puts "hello there" }.go!
You can pass arguments to go!: method(:puts).go!("greetings")
You can also call go!
top level and pass it a block: go! { puts "make sure not to share mutable state through the closure's context" }
One thing I didn't solve for: selecting on multiple channels