about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-05-09 00:05:03 -0700
committerEric Wong <normalperson@yhbt.net>2010-05-09 01:03:14 -0700
commita997f4822a99590c7a5175be4a694b4482a4b997 (patch)
treea4b0330862797e47247f57f1e40d92902c04f460 /lib
parentf3605c820fd73713e34950170bf759e1af204038 (diff)
downloadruby_posix_mq-a997f4822a99590c7a5175be4a694b4482a4b997.tar.gz
fix POSIX_MQ#notify(&block) aka SIGEV_THREAD
tests for them were stupidly broken and never executed :x
Diffstat (limited to 'lib')
-rw-r--r--lib/posix_mq.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/posix_mq.rb b/lib/posix_mq.rb
index b40a4c4..5125db5 100644
--- a/lib/posix_mq.rb
+++ b/lib/posix_mq.rb
@@ -47,7 +47,7 @@ class POSIX_MQ
     block.arity == 1 or
       raise ArgumentError, "arity of notify block must be 1"
     r, w = IO.pipe
-    self.notify_thread = Thread.new(r, w, self) do |r, w, mq|
+    self.notify_exec(w, Thread.new(r, w, self) do |r, w, mq|
       begin
         begin
           r.read(1) or raise Errno::EINTR
@@ -56,12 +56,11 @@ class POSIX_MQ
         end
         block.call(mq)
       ensure
-        mq.notify_thread = nil
+        mq.notify_cleanup
         r.close rescue nil
         w.close rescue nil
       end
-    end
-    self.notify = w
+    end)
     nil
   end if RUBY_PLATFORM =~ /linux/