Index: tests/thread.test ================================================================== --- tests/thread.test +++ tests/thread.test @@ -21,10 +21,14 @@ testConstraint testthread [expr {[info commands testthread] != {}}] testConstraint thread [expr {0 == [catch {package require Thread 2.6}]}] if {[testConstraint testthread]} { testthread errorproc ThreadError +} +if {[testConstraint thread]} { + thread::errorproc ThreadError +} proc ThreadError {id info} { global threadId threadError set threadId $id set threadError $info @@ -31,11 +35,10 @@ } proc ThreadNullError {id info} { # ignore } -} test thread-1.1 {Tcl_ThreadObjCmd: no args} {testthread} { list [catch {testthread} msg] $msg } {1 {wrong # args: should be "testthread option ?arg ...?"}} @@ -936,32 +939,33 @@ [expr {[info exists ::threadId] ? \ $::threadId == $serverthread : 0}] \ [expr {[info exists ::threadError] ? \ [lindex [split $::threadError \n] 0] : "" }] } {{} 1 0 {}} -test thread-7.26 {cancel: send async cancel bad interp path} {testthread} { - threadReap - unset -nocomplain ::threadError ::threadId ::threadIdStarted - set serverthread [testthread create -joinable { +test thread-7.26 {cancel: send async cancel bad interp path} {thread} { + unset -nocomplain ::threadIdStarted + set serverthread [thread::create -preserved \ + [string map [list MAIN [thread::id]] { proc foobar {} { while {1} { if {![info exists foo]} then { # signal the primary thread that we are ready # to be canceled now (we are running). - testthread send [testthread id -main] \ - [list set ::threadIdStarted [testthread id]] + thread::send MAIN \ + [list set ::threadIdStarted [thread::id]] set foo 1 } update } } foobar - }] + }]] # wait for other thread to signal "ready to cancel" vwait ::threadIdStarted; after 1000 - catch {testthread send $serverthread {interp cancel -- bad}} msg - threadReap + catch {thread::send $serverthread {interp cancel -- bad}} msg + thread::send -async $serverthread {interp cancel -unwind} + thread::release -wait $serverthread list [expr {[info exists ::threadIdStarted] ? \ $::threadIdStarted == $serverthread : 0}] \ $msg } {1 {could not find interpreter "bad"}} test thread-7.27 {cancel: send async cancel -- switch} {testthread} {