Sha256: 0aceee1d1bf4a1a893246e14b2e9b7f910968400c0ea960575cff23cbdf0ce01

Contents?: true

Size: 497 Bytes

Versions: 3

Compression:

Stored size: 497 Bytes

Contents

$:.unshift("../lib")
require 'ara'

class MyASynchronizedActor < Actor
  def receive(message)
    puts "Actor #{self} receive message : #{message}"
    sleep rand(10)
    reply "Thanks @ #{Time.now}!"
  end
end

def actor_response(r)
  puts "Actor send me : #{r}"
end

myASynchromizedActor = Actors.actor_of(MyASynchronizedActor).start
myASynchromizedActor < "Hello !"

puts "Message send to actor, response will arrive ;)"

12.times do |_|
  puts "I'm the main... And I'm running"
  sleep 1
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ara-0.0.3 examples/async_actor.rb
ara-0.0.2 examples/async_actor.rb
ara-0.0.1 examples/async_actor.rb