Sha256: 799e790b8990ce6ef06b70ffde68549a53f693aef7489be60a55816f37f0930b

Contents?: true

Size: 521 Bytes

Versions: 3

Compression:

Stored size: 521 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 my_response(r)
  puts "Actor send me : #{r}"
end

myASynchromizedActor = Actors.actor_of(MyASynchronizedActor).start
myASynchromizedActor.async_message("Hello !", :my_response)

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_meth.rb
ara-0.0.2 examples/async_meth.rb
ara-0.0.1 examples/async_meth.rb