about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-08-19 19:25:58 -0700
committerEric Wong <normalperson@yhbt.net>2010-08-19 19:30:59 -0700
commitcea38abf1f76b5b795b9341406ee814303f5752b (patch)
tree0d1e3345811c49cd2b101565d54013bcfb6af052 /test
parent3cf7ec34b6319693af14215ebb0da51c3e6a4603 (diff)
downloadruby_posix_mq-cea38abf1f76b5b795b9341406ee814303f5752b.tar.gz
It can be dangerous to hit (and ignore) EBADF errors in
multi-threaded applications.  Users of POSIX_MQ#to_io have two
Ruby objects pointing to the same file descriptor, making
things tricky when it comes time to reap resources.

We'll always prefer to close the Ruby IO object if it exists
(because we have less control over its GC behavior) and
ignore the raw descriptor.
Diffstat (limited to 'test')
-rw-r--r--test/test_posix_mq.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb
index 37ca664..78a005b 100644
--- a/test/test_posix_mq.rb
+++ b/test/test_posix_mq.rb
@@ -30,6 +30,7 @@ class Test_POSIX_MQ < Test::Unit::TestCase
   def test_gc
     assert_nothing_raised do
       2025.times { POSIX_MQ.new(@path, :rw) }
+      2025.times { a = POSIX_MQ.new(@path, :rw); a.to_io }
     end
   end