Signal handling problem in ruby

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/220937

I presume I am running into similar problem but this time with ruby
1.8.6(2007-03-13 patchlevel 0) [i386-mswin32] (under windows).
Basically my program runs and spawns several threads, some of which
block on
network IO but the main thread after doing all initialization etc
installs a
signal handler by trap(“INT”) { s.stop } where stop() is a method
call to
stop processing.

The ^c signal is not delivered to the program until I send a network
message
(unblocks the different thread waiting for IO).

Is this issue seen by others on 1.8.6? Any pointers are appreciated.

TIA

  • nasir

Hi Nasir,

Make sure you trap the signal in the thread you put your main sleep,
otherwise maybe the thread finishes and the trap goes nirvana…

Regards
Florian