Sha256: 2f7927cb7ac428a66b6e22b8fe30e42615ea5f5d2b98db62cc4a2e102e01a7d8

Contents?: true

Size: 418 Bytes

Versions: 1

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

def my_sleep(t)
  puts "start: #{t}"
  sleep(t)
  puts "done: #{t}"
end

puts "#{Time.now} going to sleep..."
result = supervise do |s|
  spin do
    sleep(0.5)
    puts 'stopping supervisor...'
    s.stop!
  end
  s.spin { my_sleep(1) }
  s.spin { my_sleep(2) }
  s.spin { my_sleep(3) }
end
puts "#{Time.now} woke up with #{result.inspect}"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyphony-0.23 examples/core/supervisor_with_manual_move_on.rb