Sha256: 2a163ce4c1ebe736a22825c574ceb8d88db88f23d8c3405d5b0f1db80ff04c01
Contents?: true
Size: 795 Bytes
Versions: 2
Compression:
Stored size: 795 Bytes
Contents
module Rscons # A collection of stand-alone utility methods. module Util class << self # Wait for any of a number of threads to complete. # # @param threads [Array<Thread>] # Threads to wait for. # # @return [Thread] # The Thread that completed. def wait_for_thread(*threads) if threads.empty? raise "No threads to wait for" end queue = Queue.new threads.each do |thread| # Create a wait thread for each thread we're waiting for. Thread.new do begin thread.join ensure queue.push(thread) end end end # Wait for any thread to complete. queue.pop end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rscons-1.19.1 | lib/rscons/util.rb |
rscons-1.19.0 | lib/rscons/util.rb |