With ruby 1.8.7, zmq 2.1.7 and rbzmq 2.1.3, I notice that rbzmq has signal handling problem.
With ruby 1.9.2, this problem is not occurred.
Reproduction code is below.
require 'rubygems'
require 'zmq'
c = ZMQ::Context.new
s = c.socket(ZMQ::PULL)
s.bind('ipc:///tmp/a')
begin
puts s.recv
ensure
$stderr.puts 'ensure'
s.close
c.close
end
When I input Ctrl-c and terminate this program while blocking in s.recv,
I expect the ensure closure is run and 'ensure' is shown in the terminal but actual output is below.
$ ruby intr.rb
^Cintr.rb:11: Interrupt
The line number of Interrupt is strange. Line 11 is '$stderr.puts ...'.
I think EINTR is ignored because ruby vm will handle it.
I've created a small patch for socket_recv. It seems fine but I don't know whether this is the best way.
With ruby 1.8.7, zmq 2.1.7 and rbzmq 2.1.3, I notice that rbzmq has signal handling problem. With ruby 1.9.2, this problem is not occurred.
Reproduction code is below.
When I input Ctrl-c and terminate this program while blocking in s.recv, I expect the ensure closure is run and 'ensure' is shown in the terminal but actual output is below.
The line number of Interrupt is strange. Line 11 is '$stderr.puts ...'. I think EINTR is ignored because ruby vm will handle it. I've created a small patch for socket_recv. It seems fine but I don't know whether this is the best way.