diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-10 05:19:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-10 05:19:01 +0000 |
commit | 863d148a4ee862f663c23691f34807b7f2fb450c (patch) | |
tree | 28c4216dd5dc9ef256a9acf483efcc77dfced572 /test/ruby | |
parent | d3e8f0fe7f432781951a3ad72a9331d027443d91 (diff) | |
download | ruby-863d148a4ee862f663c23691f34807b7f2fb450c.tar.gz |
process.c: kill threads in daemon process
* process.c (fork_daemon): kill the other threads all and abandon the
kept mutexes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_process.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 9a01b60acd..bfe58457d7 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1472,6 +1472,15 @@ class TestProcess < Test::Unit::TestCase assert_equal("ok?\n", data) end + def test_daemon_pid + cpid, dpid = IO.popen("-", "r+") do |f| + break f.pid, Integer(f.read) if f + Process.daemon(false, true) + puts $$ + end + assert_not_equal(cpid, dpid) + end + if File.directory?("/proc/self/task") && /netbsd[a-z]*[1-6]/ !~ RUBY_PLATFORM def test_daemon_no_threads pid, data = IO.popen("-", "r+") do |f| @@ -1483,6 +1492,18 @@ class TestProcess < Test::Unit::TestCase assert_equal(2, data.size, bug4920) assert_not_include(data.map(&:to_i), pid) end + else + 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(["1", "false"], data) + end end end |