mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-04 12:41:38 +00:00
added postfork in uwsgidsl
This commit is contained in:
+4
-11
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user