summaryrefslogtreecommitdiffstats
path: root/tests/socket.test
diff options
context:
space:
mode:
authorhershey <hershey>1999-04-20 18:12:18 (GMT)
committerhershey <hershey>1999-04-20 18:12:18 (GMT)
commit1078972debd4f992f68ecb132cb08616037048cd (patch)
treef5e45ddab0d5fdc67a74211c7040229c6827a4ae /tests/socket.test
parentd81cb57b05280ff7ad32f29f973b028856e3cd24 (diff)
downloadtcl-1078972debd4f992f68ecb132cb08616037048cd.zip
tcl-1078972debd4f992f68ecb132cb08616037048cd.tar.gz
tcl-1078972debd4f992f68ecb132cb08616037048cd.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).
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} {