diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-02-17 00:37:43 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-02-20 14:12:01 -0800 |
commit | 67a59023164bc039129b34a742f06ba376687684 (patch) | |
tree | e18be0dbb1f7229576a94abe712edc5e4523ff66 /lib | |
parent | 05e577616b74bea99a0e43e07f28823ddda1aaf9 (diff) | |
download | ruby_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 'lib')
-rw-r--r-- | lib/posix_mq.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/posix_mq.rb b/lib/posix_mq.rb index af31c16..86fa67e 100644 --- a/lib/posix_mq.rb +++ b/lib/posix_mq.rb @@ -66,6 +66,18 @@ class POSIX_MQ nil end if RUBY_PLATFORM =~ /linux/ + # There's no point in ever duping a POSIX_MQ object. + # All send/receive operations are atomic and only one + # native thread may be notified at a time + def dup + self + end + + # There's no point in ever cloning a POSIX_MQ object. + # All send/receive operations are atomic and only one + # native thread may be notified at a time + alias clone dup + end require 'posix_mq_ext' |