Skip to content

Instantly share code, notes, and snippets.

@DanielVartanov
Created November 10, 2014 15:20
Show Gist options
  • Save DanielVartanov/2a1fd7269c5212be3baf to your computer and use it in GitHub Desktop.
Save DanielVartanov/2a1fd7269c5212be3baf to your computer and use it in GitHub Desktop.
require 'celluloid'
class Cell
include Celluloid
def expensive
puts "[Started]"
sleep 1
puts "[Finished]"
end
end
cell = Cell.new
3.times.map do
cell.async.expensive
end
sleep
=begin
Outputs:
[Started]
[Started]
[Started]
[Finished]
[Finished]
[Finished]
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment