Sha256: 6f78a14bf13fa679f9718e21fab42089e1c7c9d6ae6b684fa3a18da02eb03e37

Contents?: true

Size: 509 Bytes

Versions: 6

Compression:

Stored size: 509 Bytes

Contents

module Zookeeper
  module Forked
    # the includer provides an 'original_pid' method, which is set
    # when the original 'owning' process creates the object. 
    #
    # @return [true] if the current PID differs from the original_pid value
    # @return [false] if the current PID matches the original_pid value
    #
    def forked?
      Process.pid != original_pid
    end

    # sets the `original_pid` to the current value
    def update_pid!
      self.original_pid = Process.pid
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zookeeper-1.0.3 lib/zookeeper/forked.rb
zookeeper-1.0.3-java lib/zookeeper/forked.rb
zookeeper-1.0.2 lib/zookeeper/forked.rb
zookeeper-1.0.2-java lib/zookeeper/forked.rb
zookeeper-1.0.0 lib/zookeeper/forked.rb
zookeeper-1.0.0-java lib/zookeeper/forked.rb