Sha256: 8babfe8ec1c6b08a60fb2a63b2107a05dc7aa1ce4845677c4cc3d8f222d4cccf

Contents?: true

Size: 286 Bytes

Versions: 4

Compression:

Stored size: 286 Bytes

Contents

# frozen_string_literal: true

require 'fiber'

ping = Fiber.new do |peer|
  loop do
    puts 'ping'
    sleep 0.3
    peer.transfer Fiber.current
  end
end

pong = Fiber.new do |peer|
  loop do
    puts 'pong'
    sleep 0.3
    peer.transfer Fiber.current
  end
end

ping.resume(pong)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
polyphony-0.23 examples/core/pingpong.rb
polyphony-0.22 examples/core/pingpong.rb
polyphony-0.21 examples/core/pingpong.rb
polyphony-0.20 examples/core/pingpong.rb