From 59e6ce2ef14458eb13f2214e7c6a4515811abf56 Mon Sep 17 00:00:00 2001 From: hershey Date: Tue, 20 Apr 1999 19:20:03 +0000 Subject: lint FossilOrigin-Name: 9c001e202fce88540d0d871b12df639bc5be47fd --- tests/defs.tcl | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/tests/defs.tcl b/tests/defs.tcl index 4903743..c582b52 100644 --- a/tests/defs.tcl +++ b/tests/defs.tcl @@ -11,7 +11,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: defs.tcl,v 1.3 1999/04/20 18:12:55 hershey Exp $ +# RCS: @(#) $Id: defs.tcl,v 1.4 1999/04/20 19:20:03 hershey Exp $ # Initialize wish shell @@ -99,7 +99,10 @@ namespace eval tcltest { # tests that use thread need to know which is the main thread - set ::tcltest::mainThread [testthread names] + variable ::tcltest::mainThread 1 + if {[info commands testthread] != {}} { + set ::tcltest::mainThread [testthread names] + } } # If there is no "memory" command (because memory debugging isn't @@ -1052,7 +1055,8 @@ if {[info exists tk_version]} { # threadReap -- # -# Kill all thread except for the main thread. +# Kill all threads except for the main thread. +# Do nothing if testthread is not defined. # # Arguments: # none. @@ -1060,18 +1064,24 @@ if {[info exists tk_version]} { # Results: # Returns the number of existing threads. -proc ::tcltest::threadReap {} { - testthread errorproc ThreadNullError - while {[llength [testthread names]] > 1} { - foreach tid [testthread names] { - if {$tid != $::tcltest::mainThread} { - catch {testthread send -async $tid {testthread exit}} - update +if {[info commands testthread] != {}} { + proc ::tcltest::threadReap {} { + testthread errorproc ThreadNullError + while {[llength [testthread names]] > 1} { + foreach tid [testthread names] { + if {$tid != $::tcltest::mainThread} { + catch {testthread send -async $tid {testthread exit}} + update + } } } + testthread errorproc ThreadError + return [llength [testthread names]] } - testthread errorproc ThreadError - return [llength [testthread names]] +} else { + proc ::tcltest::threadReap {} { + return 1 + } } # Need to catch the import because it fails if defs.tcl is sourced -- cgit v0.12