diff options
author | dgp <dgp@users.sourceforge.net> | 2022-10-27 17:10:04 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2022-10-27 17:10:04 (GMT) |
commit | d74dc7638ccf0c79a057c87ef0f05b7fd6974588 (patch) | |
tree | 2889b5a232098cc2c94b8baebf726e872fcd853b /tests/http.test | |
parent | 81696e00bb32025b22ec7b279732fb87593a7f54 (diff) | |
download | tcl-d74dc7638ccf0c79a057c87ef0f05b7fd6974588.zip tcl-d74dc7638ccf0c79a057c87ef0f05b7fd6974588.tar.gz tcl-d74dc7638ccf0c79a057c87ef0f05b7fd6974588.tar.bz2 |
Test hygiene. This was creating one more thread than it destroyed.
In a -singleproc 1 test run, this caused tests in later test files to fail
because the stray thread causes test results to be different.
Diffstat (limited to 'tests/http.test')
-rw-r--r-- | tests/http.test | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/http.test b/tests/http.test index 6826448..eb2bf29 100644 --- a/tests/http.test +++ b/tests/http.test @@ -47,6 +47,7 @@ if {![file exists $httpdFile]} { catch {package require Thread 2.7-} if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { set httpthread [thread::create -preserved] + lappend threadStack [list thread::release $httpthread] thread::send $httpthread [list source $httpdFile] thread::send $httpthread [list set bindata $bindata] thread::send $httpthread {httpd_init 0; set port} port @@ -64,6 +65,7 @@ if {[catch {package present Thread}] == 0 && [file exists $httpdFile]} { catch {unset port} return } + set threadStack {} } if {![info exists ThreadLevel]} { @@ -78,6 +80,7 @@ if {![info exists ThreadLevel]} { foreach ThreadLevel $ValueRange { source [info script] } + try [lpop threadStack] catch {unset ThreadLevel} catch {unset ValueRange} return @@ -1168,8 +1171,8 @@ catch {unset url} catch {unset badurl} catch {unset port} catch {unset data} -if {[info exists httpthread]} { - thread::release $httpthread +if {[llength $threadStack]} { + try [lpop threadStack] } else { close $listen } |