Module: GReactor::Settings

Defined in:
lib/greactor/settings.rb

Overview

This is the namespace for the GReactor's settings

Class Method Summary collapse

Class Method Details

.force_graceful=(value) ⇒ Object

Sets the current IO Timeout setting.


22
23
24
# File 'lib/greactor/settings.rb', line 22

def force_graceful= value
	GReactor.instance_variable_set :@graceful, value
end

.force_graceful?Boolean

Gets the current IO Timeout setting. The default setting is 0.15 seconds.

Returns:

  • (Boolean)

18
19
20
# File 'lib/greactor/settings.rb', line 18

def force_graceful?
	GReactor.instance_variable_get :@graceful
end

.forking?true, false

Returns true if the server will be forked once GReactor.join is called.

Returns:

  • (true, false)

    returns true if the server will be forked once GReactor.join is called.


39
40
41
# File 'lib/greactor/settings.rb', line 39

def forking?
	(GReactor.instance_variable_get(:@forking).to_i > 0) && Process.respond_to?(:fork)
end

.io_timeoutObject

Gets the current IO Timeout setting. The default setting is 0.15 seconds.


9
10
11
# File 'lib/greactor/settings.rb', line 9

def io_timeout
	GReactor.instance_variable_get :@io_timeout
end

.io_timeout=(value) ⇒ Object

Sets the current IO Timeout setting.


13
14
15
# File 'lib/greactor/settings.rb', line 13

def io_timeout= value
	GReactor.instance_variable_set :@io_timeout, value
end

.set_forking(val) ⇒ Fixnum

Experimental(!): Allows forking of the server by setting the number of forks.

If the forking is set to a number above 1 (and the system supports forking), the GReactor will fork itself once GReactor.join is called.

The set_forking method sets the overall number of processes, including the main process.

Returns:

  • (Fixnum)

    returns the number of processes to be used.


34
35
36
37
# File 'lib/greactor/settings.rb', line 34

def set_forking val
	GReactor.instance_variable_set :@forking,  ((val.to_i - 1) rescue 0)
	val
end