Sha256: c6e5f741fa2cc244af1c50382d12db1d71f666e177e388ab4578f693d2e8209c

Contents?: true

Size: 530 Bytes

Versions: 6

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..4).each do |pid|
  fork do
    start
  end
end

Process.waitall

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pigato-0.4.9 examples/echo_worker.rb
pigato-0.4.8 examples/echo_worker.rb
pigato-0.4.7 examples/echo_worker.rb
pigato-0.4.6 examples/echo_worker.rb
pigato-0.4.5 examples/echo_worker.rb
pigato-0.4.4 examples/echo_worker.rb