lib/async/container/hybrid.rb in async-container-0.15.0 vs lib/async/container/hybrid.rb in async-container-0.16.0
- old
+ new
@@ -1,6 +1,6 @@
-# Copyright, 2019, by Samuel G. D. Williams. <http://www.codeotaku.com>
+# Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -20,21 +20,20 @@
require_relative 'forked'
require_relative 'threaded'
module Async
- # Manages a reactor within one or more threads.
module Container
class Hybrid < Forked
def run(count: nil, forks: nil, threads: nil, **options, &block)
processor_count = Container.processor_count
count ||= processor_count ** 2
forks ||= [processor_count, count].min
threads = (count / forks).ceil
forks.times do
self.spawn(**options) do
- container = Threaded.new
+ container = Threaded::Container.new
container.run(count: threads, **options, &block)
container.wait
end