Module: Zookeeper::Forked

Included in:
CZookeeper, ZookeeperBase
Defined in:
lib/zookeeper/forked.rb

Instance Method Summary collapse

Instance Method Details

#forked?true, false

the includer provides an ‘original_pid’ method, which is set when the original ‘owning’ process creates the object.

Returns:

  • (true)

    if the current PID differs from the original_pid value

  • (false)

    if the current PID matches the original_pid value



9
10
11
# File 'lib/zookeeper/forked.rb', line 9

def forked?
  Process.pid != original_pid
end

#update_pid!Object

sets the ‘original_pid` to the current value



14
15
16
# File 'lib/zookeeper/forked.rb', line 14

def update_pid!
  self.original_pid = Process.pid
end