From a0baa7a37e79abe06322069bef4fa706950a4b18 Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 12 Sep 2011 00:41:44 +0000 Subject: Convert [testthread] use to Thread package use in thread-6.1. Eliminates a memory leak in `make valgrind`. --- ChangeLog | 3 +++ tests/thread.test | 15 ++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ddc913..ea86aec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-09-11 Don Porter + * tests/thread.test: Convert [testthread] use to Thread package + use in thread-6.1. Eliminates a memory leak in `make valgrind`. + * tests/socket.test: [Bug 3390699]: Convert [testthread] use to Thread package use in socket_*-13.1. Eliminates a memory leak in `make valgrind`. 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} { -- cgit v0.12