summaryrefslogtreecommitdiffstats
path: root/tests/socket.test
diff options
context:
space:
mode:
authorhershey <hershey@noemail.net>1999-04-20 18:12:17 (GMT)
committerhershey <hershey@noemail.net>1999-04-20 18:12:17 (GMT)
commit86303e4491ea651585d76972c7ca9dec7cf0fe5f (patch)
treef5e45ddab0d5fdc67a74211c7040229c6827a4ae /tests/socket.test
parent62402cc9727492c309c251ec3514dccfc7ea6dd7 (diff)
downloadtcl-86303e4491ea651585d76972c7ca9dec7cf0fe5f.zip
tcl-86303e4491ea651585d76972c7ca9dec7cf0fe5f.tar.gz
tcl-86303e4491ea651585d76972c7ca9dec7cf0fe5f.tar.bz2
moved the ThreadReap command to ::tcltest::threadReap. Now each thread test calls
threadReap at the beginning and end of the test, inside the test body. This fixes the problem where the test suite was exiting on a call to threadReap (reap was killing the main thread by accident because other tests were leaving threads running and setting mainthread to be the list of running threads). FossilOrigin-Name: 4ad79d115186b5269b4b20ec79edc4a8e49c5c99
Diffstat (limited to 'tests/socket.test')
-rw-r--r--tests/socket.test32
1 files changed, 8 insertions, 24 deletions
diff --git a/tests/socket.test b/tests/socket.test
index 249dc5e..8ca46ff 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: socket.test,v 1.7 1999/04/16 00:47:34 stanton Exp $
+# RCS: @(#) $Id: socket.test,v 1.8 1999/04/20 18:12:18 hershey Exp $
# Running socket tests with a remote server:
# ------------------------------------------
@@ -1579,26 +1579,10 @@ test socket-12.3 {testing inheritance of accepted sockets} \
test socket-13.1 {Testing use of shared socket between two threads} \
{socket testthread} {
- set mainthread [testthread names]
- proc ThreadReap {} {
- global mainthread
- testthread errorproc ThreadNullError
- while {[llength [testthread names]] > 1} {
- foreach tid [testthread names] {
- if {$tid != $mainthread} {
- catch {testthread send -async $tid {testthread exit}}
- update
- }
- }
- }
- testthread errorproc ThreadError
- return [llength [testthread names]]
- }
-
removeFile script
+ threadReap
- set f [open script w]
- puts $f {
+ makeFile {
set f [socket -server accept 2828]
proc accept {s a p} {
fileevent $s readable [list echo $s]
@@ -1622,16 +1606,16 @@ test socket-13.1 {Testing use of shared socket between two threads} \
# thread cleans itself up.
testthread exit
- }
- close $f
+ } script
# create a thread
set serverthread [testthread create { source script } ]
update
-
+ after 1000
set s [socket 127.0.0.1 2828]
fconfigure $s -buffering line
+
catch {
puts $s "hello"
gets $s result
@@ -1640,11 +1624,11 @@ test socket-13.1 {Testing use of shared socket between two threads} \
update
after 2000
- ThreadReap
+ lappend result [threadReap]
set result
-} hello
+} {hello 1}
# cleanup
if {[string match sock* $commandSocket] == 1} {