Permalink
Browse files

Allow for accurate setting of the PID

  • Loading branch information...
1 parent ac4a068 commit c69912b638b15db8dee8fb0c19b6a7e859f8b191 James Herdman committed Apr 11, 2012
Showing with 5 additions and 2 deletions.
  1. +3 −0 lib/raemon/master.rb
  2. +2 −2 lib/raemon/worker.rb
View
@@ -263,6 +263,7 @@ def spawn_workers
worker = worker_class.new(self, id, Raemon::Util.tmpio)
worker_pid = fork { worker_loop!(worker) }
+ worker.pid = worker_pid
WORKERS[worker_pid] = worker
end
@@ -305,6 +306,8 @@ def maintain_worker_count
# gets rid of stuff the worker has no business keeping track of
# to free some resources and drops all sig handlers.
def init_worker_process(worker)
+ worker.pid = Process.pid
+
QUEUE_SIGS.each { |sig| trap(sig, nil) }
trap(:CHLD, 'DEFAULT')
SIG_QUEUE.clear
View
@@ -6,13 +6,13 @@ def self.included(base)
end
module InstanceMethods
- attr_reader :master, :logger, :id, :pid, :pulse
+ attr_reader :master, :logger, :id, :pulse
+ attr_accessor :pid
def initialize(master, id, pulse)
@master = master
@logger = master.logger
@id = id
- @pid = Process.pid
@pulse = pulse
end

0 comments on commit c69912b

Please sign in to comment.