summaryrefslogtreecommitdiffstats
path: root/tests/socket.test
diff options
context:
space:
mode:
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} {