Skip to content

Instantly share code, notes, and snippets.

@tarcieri
Created November 19, 2012 19:28
Show Gist options
  • Select an option

  • Save tarcieri/4113104 to your computer and use it in GitHub Desktop.

Select an option

Save tarcieri/4113104 to your computer and use it in GitHub Desktop.

Revisions

  1. tarcieri revised this gist Nov 19, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions celluloid.rb
    Original file line number Diff line number Diff line change
    @@ -17,7 +17,7 @@ class Supervisor < Celluloid::SupervisionGroup
    pool Something, :as => :something
    end

    Supervisor.run
    Supervisor.new
    Celluloid::Actor[:something].async.perform

    # never get here because supervisor stops the main thread
    Celluloid::Actor[:something].async.perform
    sleep
  2. @sobrinho sobrinho created this gist Nov 19, 2012.
    23 changes: 23 additions & 0 deletions celluloid.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    require 'bundler/setup'
    require 'celluloid'

    class Something
    include Celluloid
    include Celluloid::Logger

    def perform
    # some complex operation
    sleep 10

    info 'performed'
    end
    end

    class Supervisor < Celluloid::SupervisionGroup
    pool Something, :as => :something
    end

    Supervisor.run

    # never get here because supervisor stops the main thread
    Celluloid::Actor[:something].async.perform