Sha256: 653a63cfbae2edebf49ffb9d4e06a4410c9b520bde85ec14f724b7ef72372df8
Contents?: true
Size: 583 Bytes
Versions: 1
Compression:
Stored size: 583 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'polyphony/http/server' ::Exception.__disable_sanitized_backtrace__ = true opts = { reuse_addr: true, dont_linger: true } server = Polyphony::HTTP::Server.listen('0.0.0.0', 1234, opts) puts 'Listening on port 1234' child_pids = [] 8.times do pid = Polyphony.fork do puts "forked pid: #{Process.pid}" server.each do |req| req.respond("Hello world! from pid: #{Process.pid}\n") end rescue Interrupt end child_pids << pid end child_pids.each { |pid| Thread.current.agent.waitpid(pid) }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polyphony-http-0.28 | examples/http_server_forked.rb |