Module: Async::Container

Defined in:
lib/async/container.rb,
lib/async/container/group.rb,
lib/async/container/forked.rb,
lib/async/container/hybrid.rb,
lib/async/container/version.rb,
lib/async/container/threaded.rb,
lib/async/container/controller.rb,
lib/async/container/statistics.rb,
lib/async/container/terminator.rb

Overview

Manages a reactor within one or more threads.

Defined Under Namespace

Classes: Controller, Forked, Group, Hybrid, Statistics, Terminator, Threaded

Constant Summary collapse

VERSION =
"0.14.1"

Class Method Summary collapse

Class Method Details

.best_container_classObject



30
31
32
33
34
35
36
# File 'lib/async/container.rb', line 30

def self.best_container_class
	if Process.respond_to?(:fork) and Process.respond_to?(:setpgid)
		return Forked
	else
		return Threaded
	end
end

.new(*arguments) ⇒ Object



45
46
47
# File 'lib/async/container.rb', line 45

def self.new(*arguments)
	best_container_class.new(*arguments)
end

.processor_countInteger

Returns the number of hardware processors which can run threads/processes simultaneously.

Returns:

  • (Integer)

    the number of hardware processors which can run threads/processes simultaneously.



39
40
41
42
43
# File 'lib/async/container.rb', line 39

def self.processor_count
	Etc.nprocessors
rescue
	2
end