Sha256: b8d22fb3c2461bc196d172840259acffc6cce5c8b229179eb536734c4e081b01

Contents?: true

Size: 398 Bytes

Versions: 67

Compression:

Stored size: 398 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 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

waiter.await

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
polyphony-0.66 examples/core/await.rb
polyphony-0.65 examples/core/await.rb
polyphony-0.64 examples/core/await.rb
polyphony-0.63 examples/core/await.rb
polyphony-0.62 examples/core/await.rb
polyphony-0.61 examples/core/await.rb
polyphony-0.60 examples/core/await.rb
polyphony-0.59.1 examples/core/await.rb
polyphony-0.59 examples/core/await.rb
polyphony-0.58 examples/core/await.rb
polyphony-0.57.0 examples/core/await.rb
polyphony-0.56.0 examples/core/await.rb
polyphony-0.55.0 examples/core/await.rb
polyphony-0.54.0 examples/core/await.rb
polyphony-0.53.2 examples/core/await.rb
polyphony-0.53.1 examples/core/await.rb
polyphony-0.53.0 examples/core/await.rb
polyphony-0.52.0 examples/core/await.rb
polyphony-0.51.0 examples/core/await.rb
polyphony-0.50.1 examples/core/await.rb