added postfork in uwsgidsl

This commit is contained in:
roberto@debian32
2011-11-11 09:57:35 +01:00
parent 5fe5aa70a4
commit 78a0d5f432
2 changed files with 17 additions and 11 deletions
+4 -11
View File
@@ -3,22 +3,11 @@ require 'uwsgidsl'
module UWSGI
module_function
def post_fork_hook()
puts "fork() called"
end
end
puts UWSGI.respond_to?('post_fork_hook')
signal 17,'mule5' do |signum|
end
puts UWSGI::OPT.inspect
timer 2 do |signum|
puts "ciao sono un dsl ruby: #{signum} #{UWSGI::OPT.inspect}"
end
@@ -39,6 +28,10 @@ cron 58,-1,-1,-1,-1 do |signum|
puts "cron ready #{signum}"
end
postfork do
puts "fork() called"
end
begin
foo_func
rescue
+13
View File
@@ -12,6 +12,15 @@ def get_free_signal()
end
end
$postfork_chain = []
module UWSGI
module_function
def post_fork_hook()
$postfork_chain.each {|func| func.call }
end
end
def timer(secs, target='', &block)
freesig = get_free_signal
UWSGI.register_signal(freesig, target, block)
@@ -39,3 +48,7 @@ end
def signal(signum, target='', &block)
UWSGI.register_signal(signum, target, block)
end
def postfork(&block)
$postfork_chain << block
end