lib/async/container/threaded.rb in async-container-0.6.1 vs lib/async/container/threaded.rb in async-container-0.7.0

- old
+ new

@@ -25,17 +25,20 @@ module Async module Container # Manages a reactor within one or more threads. class Threaded - def initialize(concurrency: 1, &block) + def initialize(concurrency: 1, name: nil, &block) @reactors = concurrency.times.collect do Async::Reactor.new end @threads = @reactors.collect do |reactor| Thread.new do - Thread.current.abort_on_exception = true + thread = Thread.current + + thread.abort_on_exception = true + thread.name = name if name begin reactor.run(&block) rescue Interrupt # Exit cleanly.