Sha256: c17c34f4ac647537eae6a918f851dc4906e18d87e22594f78b513610869275dd

Contents?: true

Size: 530 Bytes

Versions: 1

Compression:

Stored size: 530 Bytes

Contents

#!/usr/bin/env ruby

require "rubygems"
require "#{File.dirname(__FILE__)}/../lib/pigato.rb"
#require "pigato"

def start
  ts = []

  (0..10).each do |tid|
    ts << Thread.new {
      worker = Pigato::Worker.new('tcp://127.0.0.1:55555', 'echo')
      worker.start

      loop do
        request = worker.recv
        if !request.nil?
          worker.reply request
        end
        #sleep 0.1
      end
    }
  end

  ts.each do |to|
    to.join
  end
end

(0..2).each do |pid|
  fork do
    start
  end
end

Process.waitall

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pigato-0.5.0 examples/echo_worker.rb