Forum: Ruby signal handler problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Nasir K. (Guest)
on 2007-06-28 10:52
(Received via mailing list)
Consider the snippet -

require 'socket'
require 'thread'

 t = do
   sock =
   sock.bind("", 9000)
   2.times do[sock])
     msg = sock.recvfrom_nonblock(1000)
     puts msg

puts "installing signal handler"

trap("INT") { puts "control-c received" }  # do nothing, just print

# ---------------------------------

One user thread blocks on IO and the main thread joins for this thread
after installing a signal handler.
I would expect the control-c to be trapped by this but that does not
until the thread blocked for IO is unblocked by a network message.

My ruby is "ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]"

Am I missing something here?

- Nasir
This topic is locked and can not be replied to.