summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhershey <hershey>1999-04-20 19:20:03 (GMT)
committerhershey <hershey>1999-04-20 19:20:03 (GMT)
commite38dd7f49658db57b71523a94c2a90f301797a4e (patch)
tree97e98d2865b4085ed00436a0718a1dfad5dd7b9a /tests
parent5e4f74d986ec0791afeedc9a1d33a177c41a81c0 (diff)
downloadtk-e38dd7f49658db57b71523a94c2a90f301797a4e.zip
tk-e38dd7f49658db57b71523a94c2a90f301797a4e.tar.gz
tk-e38dd7f49658db57b71523a94c2a90f301797a4e.tar.bz2
lint
Diffstat (limited to 'tests')
-rw-r--r--tests/defs.tcl34
1 files 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