Skip to content

Commit

Permalink
create actors
Browse files Browse the repository at this point in the history
  • Loading branch information
will committed Nov 27, 2009
1 parent 6e7d976 commit 152ecf9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions drb/drbactor.rb
Expand Up @@ -5,6 +5,7 @@ class NodeManager
extend Actorize extend Actorize
def initialize def initialize
@ts = TupleClient::get_ts @ts = TupleClient::get_ts
@actors = {}
receive_loop receive_loop
end end


Expand All @@ -14,13 +15,22 @@ def init
call :init, :when => :init call :init, :when => :init


def get_messages def get_messages
take_all { |msg| p msg } take_all do |msg|
puts "..." p msg
Actor.current << msg
end
puts "... #{@actors.inspect}"

Actor.current << :get_messages Actor.current << :get_messages
Actor.sleep 2 Actor.sleep 2
end end
call :get_messages, :when => :get_messages call :get_messages, :when => :get_messages


def create_actor(_, actor_name, class_name)
@actors[actor_name] = Module::const_get(class_name).spawn
end
call :create_actor, :when => T[:create_actor]

private private


def take_all def take_all
Expand Down

0 comments on commit 152ecf9

Please sign in to comment.