about summary refs log tree commit homepage
path: root/test/test_posix_mq.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-17 00:37:43 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-20 14:12:01 -0800
commit67a59023164bc039129b34a742f06ba376687684 (patch)
treee18be0dbb1f7229576a94abe712edc5e4523ff66 /test/test_posix_mq.rb
parent05e577616b74bea99a0e43e07f28823ddda1aaf9 (diff)
downloadruby_posix_mq-67a59023164bc039129b34a742f06ba376687684.tar.gz
It'll cause problems for the automatic mq_close() during GC
otherwise, as dup(2) on an mqd_t isn't portable.

Of course there's no point in cloning or duping, either, as
mq_send/mq_receive operations are always atomic at the kernel
level and only one thread can have a notification registered
for it.
Diffstat (limited to 'test/test_posix_mq.rb')
-rw-r--r--test/test_posix_mq.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_posix_mq.rb b/test/test_posix_mq.rb
index 42be59a..fa98a9c 100644
--- a/test/test_posix_mq.rb
+++ b/test/test_posix_mq.rb
@@ -27,6 +27,14 @@ class Test_POSIX_MQ < Test::Unit::TestCase
     assert @mq.closed?
   end
 
+  def test_dup_clone
+    @mq = POSIX_MQ.new(@path, :rw)
+    dup = @mq.dup
+    assert_equal @mq.object_id, dup.object_id
+    clone = @mq.clone
+    assert_equal @mq.object_id, clone.object_id
+  end
+
   def test_timed_receive
     interval = 0.01
     @mq = POSIX_MQ.new(@path, :rw)