Sha256: dd338d80029227338066fb34decff059de1bb1aac4ff822b2ad7cd8c1164e977
Contents?: true
Size: 849 Bytes
Versions: 1
Compression:
Stored size: 849 Bytes
Contents
require File.join(File.dirname(__FILE__), 'daemon_spawn_base') require File.join(File.dirname(__FILE__), 'mini_process') class Forking # opts: # :name # :sync_log # :log_file # :pid_file # :working_dir * def initialize(opts = {}) @opts = opts @merge_opts = opts.update(:sync_log => nil) # sync_log should specify for each spawn @procs = [] end def run! $0 = "#{@opts[:name]} spawner" unless @opts[:dont_touch_pl] DaemonSpawnBase.spawn!(@opts.merge(:procs => @procs, :before_fork => @before_fork, :application => @opts[:name])) end def spawn(opts = {}, &block) @procs << MiniProcess.new(@merge_opts.merge(opts).merge(:after_fork => @after_fork), &block) end def before_fork(&block) @before_fork = block end def after_fork(&block) @after_fork = block end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forking-0.1 | lib/forking.rb |