Skip to content

Commit fe573fd

Browse files
committed
Use actual per-thread variable.
1 parent 0cab8a0 commit fe573fd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/debug/thread_client.rb

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
require_relative 'color'
77

8+
class ::Thread
9+
attr_accessor :debug_thread_client
10+
end
11+
812
module DEBUGGER__
913
M_INSTANCE_VARIABLES = method(:instance_variables).unbind
1014
M_INSTANCE_VARIABLE_GET = method(:instance_variable_get).unbind
@@ -48,12 +52,7 @@ def safe_global_variables
4852

4953
class ThreadClient
5054
def self.current
51-
if thc = Thread.current[:DEBUGGER__ThreadClient]
52-
thc
53-
else
54-
thc = SESSION.get_thread_client
55-
Thread.current[:DEBUGGER__ThreadClient] = thc
56-
end
55+
Thread.current.debug_thread_client ||= SESSION.get_thread_client
5756
end
5857

5958
include Color

0 commit comments

Comments
 (0)