Class: Process::Group::Fork
- Inherits:
-
Object
- Object
- Process::Group::Fork
- Defined in:
- lib/process/group.rb
Instance Method Summary collapse
-
#initialize(block, options, fiber = Fiber.current) ⇒ Fork
constructor
A new instance of Fork.
- #resume(*arguments) ⇒ Object
- #run(options = {}) ⇒ Object
Constructor Details
#initialize(block, options, fiber = Fiber.current) ⇒ Fork
Returns a new instance of Fork.
49 50 51 52 53 54 |
# File 'lib/process/group.rb', line 49 def initialize(block, , fiber = Fiber.current) @options = @block = block @fiber = fiber end |
Instance Method Details
#resume(*arguments) ⇒ Object
70 71 72 |
# File 'lib/process/group.rb', line 70 def resume(*arguments) @fiber.resume(*arguments) end |
#run(options = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/process/group.rb', line 56 def run( = {}) @pid = Process.fork(&@block) if [:pgroup] == true # Establishes the child process as a process group leader: Process.setpgid(@pid, 0) else # Set this process as part of the existing process group: Process.setpgid(@pid, [:pgroup]) end return @pid end |