aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 02:52:26 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-10-06 02:52:26 +0000
commit915ae780c37478fea358d6c77513a728e86a10f2 (patch)
tree7776a2822ff87357d287ef8a11609b00f01e66d0 /test/ruby
parenta413c84e543528d31190f22ecdf1a5f7363cedc9 (diff)
downloadruby-915ae780c37478fea358d6c77513a728e86a10f2.tar.gz
* io.c (fptr_finalize): write_mutex might have been destroyed
already in finalization phase, as the order of finalizers is not guaranteed. rb_mutex_t should be used in place of Mutex object in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 1cfcba181a..0d89b58b59 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1625,4 +1625,33 @@ End
end
end.each {|th| th.join}
end
+
+ def test_flush_in_finalizer1
+ require 'tempfile'
+ bug3910 = '[ruby-dev:42341]'
+ path = Tempfile.new("bug3910").path
+ fds = []
+ assert_nothing_raised(TypeError, bug3910) do
+ 500.times {
+ f = File.open(path, "w")
+ fds << f.fileno
+ f.print "hoge"
+ }
+ end
+ ensure
+ fds.each {|fd| IO.for_fd(fd).close rescue next}
+ end
+
+ def test_flush_in_finalizer2
+ require 'tempfile'
+ bug3910 = '[ruby-dev:42341]'
+ path = Tempfile.new("bug3910").path
+ 1.times do
+ io = open(path,"w")
+ io.print "hoge"
+ end
+ assert_nothing_raised(TypeError, bug3910) do
+ GC.start
+ end
+ end
end