File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,37 @@ proc ThreadReap {} {
3333 llength [thread::names]
3434}
3535
36+ test thread-1.11 {no segfault on 2nd interpreter, bug [d4ba38d00d06ebba]} -body {
37+ # This behavior needs to be covered in a separate shell, because it doesn't expect
38+ # any other thread invocation before 2nd interpreter gets the thread::id (TSD),
39+ # but test-suite calls thread::id command (tcltest, all.tcl and thread.test):
40+ set fd [open [list |[info nameofexecutable] << [string map [list {$$load} [tcltest::loadScript]] {
41+ $$load; package require thread
42+ interp create ci
43+ set l {}
44+ ci eval {$$load; package require thread; thread::id}
45+ thread::send -async [thread::id] {lappend l ev-1}; update
46+ interp delete ci
47+ thread::send -async [thread::id] {lappend l ev-2}; update; # no SF here
48+ puts $l
49+ }] 2>@stderr] r]
50+ gets $fd
51+ } -cleanup {
52+ catch { close $fd }
53+ } -result {ev-1 ev-2}
54+
55+ test thread-1.12 {no events in 2nd interpreter, bug [d4ba38d00d06ebba]} -setup {
56+ interp create ci
57+ } -body {
58+ set l {}
59+ thread::send -async [thread::id] {lappend l ev-1}; update
60+ ci eval {package require tcltest; tcltest::loadTestedCommands; package require thread}
61+ thread::send -async [thread::id] {lappend l ev-2}; update
62+ set l
63+ } -cleanup {
64+ interp delete ci
65+ } -result {ev-1 ev-2}
66+
3667test thread-2.0 {no global thread command} {
3768 info commands thread
3869} {}
You can’t perform that action at this time.
0 commit comments