Project

General

Profile

Actions

Bug #362

closed

Signal handling meets threading

Added by senotrusov (Stanislav Senotrusov) over 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
-
[ruby-core:17970]

Description

=begin
I found a bug and some workaround while trying to implement
termination watchdog.

ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux] on Ubuntu 8.04

Bug:

Run me and press Ctrl+C

Signal.trap('INT') do
Thread.new do
puts "Got SIGINT"
Thread.main.join(1)
puts "Timeout is never reached!"
end
end

sleep 100

And a workaround

Run me and press Ctrl+C

killer = Thread.new do
Thread.stop

puts "Got SIGINT"
Thread.main.join(1)

puts "Timeout is reached!"
Thread.main.raise "Timeout!"

end

Signal.trap('INT') do
killer.run
end

sleep 100

------------------------------

=end

Actions #1

Updated by marcandre (Marc-Andre Lafortune) about 15 years ago

  • Status changed from Open to Closed
  • ruby -v set to -

=begin
Closing this issue since it appears to be fixed in trunk.
=end

Actions

Also available in: Atom PDF

Like0
Like0