From 704807694af4a1b60cb2d166f3c52c69a35b474f Mon Sep 17 00:00:00 2001
From: kjnash <k.j.nash@usa.net>
Date: Tue, 5 Dec 2023 11:55:14 +0000
Subject: Define http(usingThread) more precisely

---
 library/http/http.tcl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/library/http/http.tcl b/library/http/http.tcl
index 6c3c068..da345e3 100644
--- a/library/http/http.tcl
+++ b/library/http/http.tcl
@@ -5293,13 +5293,17 @@ proc http::socket {args} {
 # value 1 => operate as if -threadlevel 0
 # value 2 => error return
 #
+# The command assigns a value to http(usingThread), which records whether
+# command http::socket can use a separate thread.
+#
 # Arguments: none
 # Return Value: none
 # ------------------------------------------------------------------------------
 
 proc http::LoadThreadIfNeeded {} {
     variable http
-    if {$http(usingThread) || ($http(-threadlevel) == 0)} {
+    if {$http(-threadlevel) == 0} {
+        set http(usingThread) 0
         return
     }
     if {[catch {package require Thread}]} {
@@ -5308,6 +5312,7 @@ proc http::LoadThreadIfNeeded {} {
                      but the Thread package is not available}
             return -code error $msg
         }
+        set http(usingThread) 0
         return
     }
     set http(usingThread) 1
-- 
cgit v0.12