Skip to content

Commit 5bca348

Browse files
committed
#137 fix warnings on thread aliasing
1 parent 01219ce commit 5bca348

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

lib/ruby-debug-ide/thread-alias/alias_thread.rb

Lines changed: 0 additions & 2 deletions
This file was deleted.

lib/ruby-debug-ide/thread-alias/unalias_thread.rb

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/ruby-debug-ide/thread_alias.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@ module Debugger
22
module TimeoutHandler
33
class << self
44
def do_thread_alias
5-
load File.expand_path(File.dirname(__FILE__) + '/thread-alias/alias_thread.rb')
5+
if defined? ::OldThread
6+
Debugger.print_debug 'Tried to re-alias thread for eval'
7+
return
8+
end
9+
10+
Object.const_set :OldThread, ::Thread
11+
Object.send :remove_const, :Thread
12+
Object.const_set :Thread, ::Debugger::DebugThread
613
end
714

815
def undo_thread_alias
9-
load File.expand_path(File.dirname(__FILE__) + '/thread-alias/unalias_thread.rb')
16+
unless defined? ::OldThread
17+
Debugger.print_debug 'Tried to de-alias thread twice'
18+
return
19+
end
20+
21+
Object.send :remove_const, :Thread
22+
Object.const_set :Thread, ::OldThread
23+
Object.send :remove_const, :OldThread
1024
end
1125
end
1226
end

0 commit comments

Comments
 (0)