Sha256: 32f57d7bd0185bd9feee8861cad78bd9931a676ab67dce0780fa19db7476d8bb

Contents?: true

Size: 667 Bytes

Versions: 2

Compression:

Stored size: 667 Bytes

Contents

$:.push(File.join(File.dirname(__FILE__), "..", "..", "lib"))
require "marilyn-rpc"
client = MarilynRPC::NativeClient.connect_tcp('localhost', 8000)
SimpleCommandService = client.for(:cmd)

start_time = Time.now

t1 = Thread.new do
  SimpleCommandService.exec("sleep 5")
  puts "ls -al\n: " + SimpleCommandService.exec("ls -al")
end

t2 = Thread.new do
  SimpleCommandService.exec("sleep 2")
  puts "uname -a\n: " + SimpleCommandService.exec("uname -a")
end

done = false
t3 = Thread.new do
  while !done
    sleep 1
    STDOUT.print "."
    STDOUT.flush
  end
end

t1.join
t2.join

done = true
end_time = Time.now

puts "#{start_time - end_time}"

client.disconnect

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
marilyn-rpc-0.0.4 examples/async/client.rb
marilyn-rpc-0.0.3 examples/async/client.rb