ruby-changes:29858
From: naruse <ko1@a...>
Date: Thu, 11 Jul 2013 10:13:21 +0900 (JST)
Subject: [ruby-changes:29858] naruse:r41910 (trunk): * process.c (rb_daemon): daemon(3) is implemented with fork(2).
naruse 2013-07-11 10:13:10 +0900 (Thu, 11 Jul 2013) New Revision: 41910 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41910 Log: * process.c (rb_daemon): daemon(3) is implemented with fork(2). Therefore it needs rb_thread_atfork(). (and revert r41903) Modified files: trunk/ChangeLog trunk/process.c trunk/test/ruby/test_process.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 41909) +++ ChangeLog (revision 41910) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jul 11 10:09:18 2013 NARUSE, Yui <naruse@r...> + + * process.c (rb_daemon): daemon(3) is implemented with fork(2). + Therefore it needs rb_thread_atfork(). (and revert r41903) + Thu Jul 11 03:22:10 2013 Aaron Patterson <aaron@t...> * tool/probes_to_wiki.rb: adding a script to convert probes.d to wiki Index: process.c =================================================================== --- process.c (revision 41909) +++ process.c (revision 41910) @@ -5736,6 +5736,7 @@ rb_daemon(int nochdir, int noclose) https://github.com/ruby/ruby/blob/trunk/process.c#L5736 before_fork(); err = daemon(nochdir, noclose); after_fork(); + rb_thread_atfork(); #else int n; Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 41909) +++ test/ruby/test_process.rb (revision 41910) @@ -1492,18 +1492,6 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L1492 assert_equal(2, data.size, bug4920) assert_not_include(data.map(&:to_i), pid) end - elsif /freebsd/ =~ RUBY_PLATFORM - def test_daemon_no_threads - data = Timeout.timeout(3) do - IO.popen("-") do |f| - break f.readlines.map(&:chomp) if f - th = Thread.start {sleep 3} - Process.daemon(true, true) - puts Thread.list.size, th.status.inspect - end - end - assert_equal(["2", "\"run\""], data) - end else # darwin def test_daemon_no_threads data = Timeout.timeout(3) do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/