lib/celluloid.rb in celluloid-0.9.1 vs lib/celluloid.rb in celluloid-0.10.0

- old
+ new

@@ -23,15 +23,12 @@ actor? and Thread.current[:actor].exclusive? end # Obtain the currently running actor (if one exists) def current_actor - actor = Thread.current[:actor] - raise NotActorError, "not in actor scope" unless actor - actor.proxy + Actor.current end - alias_method :current, :current_actor # Receive an asynchronous message def receive(timeout = nil, &block) actor = Thread.current[:actor] if actor @@ -109,11 +106,11 @@ end alias_method :spawn, :new # Create a new actor and link to the current one def new_link(*args, &block) - current_actor = Celluloid.current_actor + current_actor = Actor.current raise NotActorError, "can't link outside actor context" unless current_actor proxy = Actor.new(allocate).proxy current_actor.link proxy proxy._send_(:initialize, *args, &block) @@ -205,11 +202,11 @@ Thread.current[:actor].wait name end # Obtain the current_actor def current_actor - Celluloid.current_actor + Actor.current end # Obtain the running tasks for this actor def tasks Thread.current[:actor].tasks.to_a @@ -227,16 +224,16 @@ Thread.current[:actor].links end # Link this actor to another, allowing it to crash or react to errors def link(actor) - actor.notify_link current_actor + actor.notify_link Actor.current notify_link actor end # Remove links to another actor def unlink(actor) - actor.notify_unlink current_actor + actor.notify_unlink Actor.current notify_unlink actor end def notify_link(actor) links << actor