Sha256: c842ad09cbfee606137dc2167bcc3d75042487345c01d9d22dc208f25a3d6825

Contents?: true

Size: 415 Bytes

Versions: 2

Compression:

Stored size: 415 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'

sleeper = spin do
  puts 'going to sleep'
  sleep 1
  puts 'woke up'
end

# One way to synchronize coprocesses is by using `Coprocess#await`, which blocks
# until the coprocess has finished running or has been interrupted.
waiter = spin do
  puts 'waiting for coprocess to terminate'
  sleeper.await
  puts 'done waiting'
end

waiter.await

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
polyphony-0.24 examples/core/02-awaiting-coprocesses.rb
polyphony-0.23 examples/core/02-awaiting-coprocesses.rb