From bfe9568a8eb85cc004d235c50382d5ad0d472b23 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Sun, 4 Jun 2023 15:48:45 +0900 Subject: [PATCH] Use actual per-thread variable. --- lib/debug/thread_client.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/debug/thread_client.rb b/lib/debug/thread_client.rb index 332100ba7..fbb1dd281 100644 --- a/lib/debug/thread_client.rb +++ b/lib/debug/thread_client.rb @@ -5,6 +5,10 @@ require_relative 'color' +class ::Thread + attr_accessor :debug_thread_client +end + module DEBUGGER__ M_INSTANCE_VARIABLES = method(:instance_variables).unbind M_INSTANCE_VARIABLE_GET = method(:instance_variable_get).unbind @@ -48,12 +52,7 @@ def safe_global_variables class ThreadClient def self.current - if thc = Thread.current[:DEBUGGER__ThreadClient] - thc - else - thc = SESSION.get_thread_client - Thread.current[:DEBUGGER__ThreadClient] = thc - end + Thread.current.debug_thread_client ||= SESSION.get_thread_client end include Color