Sha256: e94c1b01cf0a4a65c8fa89e212e58f44f89d30166c476943e3df0666213c9f18
Contents?: true
Size: 394 Bytes
Versions: 14
Compression:
Stored size: 394 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'polyphony' def nap(tag, t) puts "#{Time.now} #{tag} napping for #{t} seconds..." sleep t puts "#{Time.now} #{tag} done napping" end # We launch two concurrent fibers, each sleeping for the given duration. spin { nap(:a, 1) } spin { nap(:b, 2) } # Calling suspend will block until all child fibers have terminated suspend
Version data entries
14 entries across 14 versions & 1 rubygems