Class: SweetPi::Fork
- Inherits:
-
Object
- Object
- SweetPi::Fork
- Defined in:
- lib/sweet_pi/fork.rb
Instance Method Summary collapse
-
#initialize(*argv, &block) ⇒ Fork
constructor
A new instance of Fork.
- #value ⇒ Object
Constructor Details
#initialize(*argv, &block) ⇒ Fork
Returns a new instance of Fork.
6 7 8 9 10 11 |
# File 'lib/sweet_pi/fork.rb', line 6 def initialize(*argv, &block) @status_read, @status_write = IO.pipe @value_read, @value_write = IO.pipe child_fork(*argv, block) end |
Instance Method Details
#value ⇒ Object
13 14 15 16 |
# File 'lib/sweet_pi/fork.rb', line 13 def value Process.waitpid @pid Marshal.load(@value_read) end |