Sha256: affaa92bd3e04d77c41c5ca561b7a408cc9109ec3db0986a7a6ac702272b5390
Contents?: true
Size: 583 Bytes
Versions: 8
Compression:
Stored size: 583 Bytes
Contents
require_relative '../spectre' Thread.abort_on_exception = true module Spectre module Async class << self @@threads = {} def async name='default', &block unless @@threads.key? name @@threads[name] = [] end @@threads[name] << Thread.new(&block) end def await name='default' return unless @@threads.key? name threads = @@threads[name].map { |x| x.join() } @@threads.delete(name) threads.map { |x| x.value } end end Spectre.delegate :async, :await, to: self end end
Version data entries
8 entries across 8 versions & 1 rubygems