diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-05-09 00:05:03 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-05-09 01:03:14 -0700 |
commit | a997f4822a99590c7a5175be4a694b4482a4b997 (patch) | |
tree | a4b0330862797e47247f57f1e40d92902c04f460 /lib/posix_mq.rb | |
parent | f3605c820fd73713e34950170bf759e1af204038 (diff) | |
download | ruby_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/posix_mq.rb')
-rw-r--r-- | lib/posix_mq.rb | 7 |
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/ |