Sha256: cf5616c75929eb0f23f246aa50ca9bfb6b4b193e25571d1b17856d4ab15e3649

Contents?: true

Size: 830 Bytes

Versions: 20

Compression:

Stored size: 830 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

Exception.__disable_sanitized_backtrace__ = true

puts "Parent pid: #{Process.pid}"

def start_worker
  Polyphony.fork do
    p :sleep
    sleep 5
    p :done_sleeping
  ensure
    p :start_worker_fork_ensure
  end
end

f = spin do
  Polyphony::ProcessSupervisor.supervise do
    spin do
      spin do
        p :sleep
        sleep 5
        p :done_sleeping
      end.await
    end.await
  ensure
    p :start_worker_fork_ensure
  end
  # spin do
  #   pid = start_worker
  #   p [:before_child_await, pid]
  #   Gyro::Child.new(pid).await
  #   p :after_child_await
  # ensure
  #   puts "child done"
  # end
  # supervise
# ensure
#   puts "kill child"
#   Process.kill('TERM', pid) rescue nil
end

sleep 1
puts "terminate worker"
f.terminate
f.await

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
polyphony-0.45.0 examples/core/xx-spin-fork.rb
polyphony-0.44.0 examples/core/xx-spin-fork.rb
polyphony-0.43.11 examples/core/xx-spin-fork.rb
polyphony-0.43.10 examples/core/xx-spin-fork.rb
polyphony-0.43.9 examples/core/xx-spin-fork.rb
polyphony-0.43.8 examples/core/xx-spin-fork.rb
polyphony-0.43.6 examples/core/xx-spin-fork.rb
polyphony-0.43.5 examples/core/xx-spin-fork.rb
polyphony-0.43.4 examples/core/xx-spin-fork.rb
polyphony-0.43.3 examples/core/xx-spin-fork.rb
polyphony-0.43.2 examples/core/xx-spin-fork.rb
polyphony-0.43.1 examples/core/xx-spin-fork.rb
polyphony-0.43 examples/core/xx-spin-fork.rb
polyphony-0.42 examples/core/xx-spin-fork.rb
polyphony-0.41 examples/core/xx-spin-fork.rb
polyphony-0.40 examples/core/xx-spin-fork.rb
polyphony-0.39 examples/core/xx-spin-fork.rb
polyphony-0.38 examples/core/xx-spin-fork.rb
polyphony-0.36 examples/core/xx-spin-fork.rb
polyphony-0.34 examples/core/xx-spin-fork.rb