lib/async/container.rb in async-container-0.2.2 vs lib/async/container.rb in async-container-0.3.0
- old
+ new
@@ -18,13 +18,21 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
require_relative 'container/threaded'
+require 'etc'
+
module Async
# Manages a reactor within one or more threads.
module Container
def self.new(**options, &block)
Threaded.new(**options, &block)
+ end
+
+ def self.hardware_concurrency
+ Etc.nprocessors
+ rescue
+ 2
end
end
end