Sha256: 40430abe4dee481a7d6051078940fdfb1942287baaa75a96f7bc840a770a1004

Contents?: true

Size: 574 Bytes

Versions: 31

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

require 'bundler/setup'
require 'polyphony'
require 'polyphony/extensions/debug'

Exception.__disable_sanitized_backtrace__ = true

puts '----- start await example ------'
sleeper = spin do
  puts 'going to sleep'
  sleep 1
  puts 'woke up'
end

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

trace :before_await

sleep 2
waiter.await
trace :after_await

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
polyphony-0.95 examples/core/await.rb
polyphony-0.94 examples/core/await.rb
polyphony-0.93 examples/core/await.rb
polyphony-0.92 examples/core/await.rb
polyphony-0.91 examples/core/await.rb
polyphony-0.90 examples/core/await.rb
polyphony-0.89 examples/core/await.rb
polyphony-0.87 examples/core/await.rb
polyphony-0.86 examples/core/await.rb
polyphony-0.85 examples/core/await.rb
polyphony-0.84.1 examples/core/await.rb
polyphony-0.84 examples/core/await.rb
polyphony-0.83 examples/core/await.rb
polyphony-0.82 examples/core/await.rb
polyphony-0.81.1 examples/core/await.rb
polyphony-0.81 examples/core/await.rb
polyphony-0.80 examples/core/await.rb
polyphony-0.79 examples/core/await.rb
polyphony-0.78 examples/core/await.rb
polyphony-0.77 examples/core/await.rb