From 7b78279bacaab05c7ae42e7e5b487e290a02292a Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 12 Sep 2011 16:19:07 +0000 Subject: Attempt to convert test thread-7.26 --- tests/thread.test | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/thread.test b/tests/thread.test index 6cd4b5d..62cdb24 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -938,28 +938,28 @@ test thread-7.25 {cancel: nested catch inside pure inside-command loop} {testthr [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::release -wait $serverthread list [expr {[info exists ::threadIdStarted] ? \ $::threadIdStarted == $serverthread : 0}] \ $msg -- cgit v0.12 From 71ccb108c1bc10efa33e1318cf6079986176e0fd Mon Sep 17 00:00:00 2001 From: dgp Date: Mon, 12 Sep 2011 17:52:19 +0000 Subject: stop segfault --- tests/thread.test | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/thread.test b/tests/thread.test index 62cdb24..865c7c6 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -23,6 +23,10 @@ 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 @@ -33,7 +37,6 @@ if {[testConstraint testthread]} { proc ThreadNullError {id info} { # ignore } -} test thread-1.1 {Tcl_ThreadObjCmd: no args} {testthread} { @@ -959,6 +962,7 @@ test thread-7.26 {cancel: send async cancel bad interp path} {thread} { # wait for other thread to signal "ready to cancel" vwait ::threadIdStarted; after 1000 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}] \ -- cgit v0.12