Skip to content

Instantly share code, notes, and snippets.

@DougEverly
Created May 21, 2016 01:17
Show Gist options
  • Select an option

  • Save DougEverly/4cf259c8897666b6e173c1b7c4249730 to your computer and use it in GitHub Desktop.

Select an option

Save DougEverly/4cf259c8897666b6e173c1b7c4249730 to your computer and use it in GitHub Desktop.
ch = Channel(Nil).new
spawn do
6.times do
sleep 1
puts 1
end
ch.send(nil)
end
spawn do
3.times do
sleep 2
puts 2
end
ch.send(nil)
end
2.times { ch.receive }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment