Module: Async::Container

Defined in:
lib/async/container.rb,
lib/async/container/best.rb,
lib/async/container/error.rb,
lib/async/container/group.rb,
lib/async/container/keyed.rb,
lib/async/container/forked.rb,
lib/async/container/hybrid.rb,
lib/async/container/notify.rb,
lib/async/container/thread.rb,
lib/async/container/channel.rb,
lib/async/container/generic.rb,
lib/async/container/process.rb,
lib/async/container/version.rb,
lib/async/container/threaded.rb,
lib/async/container/controller.rb,
lib/async/container/statistics.rb,
lib/async/container/notify/pipe.rb,
lib/async/container/notify/client.rb,
lib/async/container/notify/server.rb,
lib/async/container/notify/socket.rb

Overview

Manages a reactor within one or more threads.

Defined Under Namespace

Modules: Notify Classes: Channel, ContainerError, Controller, Error, Forked, Generic, Group, Hybrid, Keyed, Process, Statistics, Terminate, Thread, Threaded

Constant Summary collapse

Interrupt =
::Interrupt
VERSION =
"0.16.0"

Class Method Summary collapse

Class Method Details

.best_container_classObject



32
33
34
35
36
37
38
# File 'lib/async/container/best.rb', line 32

def self.best_container_class
	if fork?
		return Forked
	else
		return Threaded
	end
end

.fork?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/async/container/best.rb', line 28

def self.fork?
	::Process.respond_to?(:fork) && ::Process.respond_to?(:setpgid)
end

.new(*arguments) ⇒ Object



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

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.



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

def self.processor_count
	Etc.nprocessors
rescue
	2
end