diff options
author | dgp <dgp@users.sourceforge.net> | 2011-09-12 00:41:44 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-09-12 00:41:44 (GMT) |
commit | a0baa7a37e79abe06322069bef4fa706950a4b18 (patch) | |
tree | 24a7f17a08df4253f28ef5c8b0b3c4c90eacd236 /tests | |
parent | 0316c6eff20ff2d18f2b47d72f9d83fa497d5731 (diff) | |
download | tcl-a0baa7a37e79abe06322069bef4fa706950a4b18.zip tcl-a0baa7a37e79abe06322069bef4fa706950a4b18.tar.gz tcl-a0baa7a37e79abe06322069bef4fa706950a4b18.tar.bz2 |
Convert [testthread] use to Thread package use in thread-6.1.
Eliminates a memory leak in `make valgrind`.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/thread.test | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/thread.test b/tests/thread.test index a6961ed..db28dc9 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -19,6 +19,7 @@ if {[lsearch [namespace children] ::tcltest] == -1} { # Some tests require the testthread command testConstraint testthread [expr {[info commands testthread] != {}}] +testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] if {[testConstraint testthread]} { testthread errorproc ThreadError @@ -239,22 +240,18 @@ test thread-5.2 {Try to join a detached thread} {testthread} { lrange $msg 0 2 } {cannot join thread} -test thread-6.1 {freeing very large object trees in a thread} testthread { +test thread-6.1 {freeing very large object trees in a thread} thread { # conceptual duplicate of obj-32.1 - threadReap - set serverthread [testthread create -joinable] - testthread send -async $serverthread { + set serverthread [thread::create -preserved] + thread::send -async $serverthread { set x {} for {set i 0} {$i<100000} {incr i} { set x [list $x {}] } unset x - testthread exit } - catch {set res [testthread join $serverthread]} msg - threadReap - set res -} {0} + thread::release -wait $serverthread +} 0 # TIP #285: Script cancellation support test thread-7.1 {cancel: args} {testthread} { |