summaryrefslogtreecommitdiffstats
path: root/tests/thread.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-07-23 16:53:42 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-07-23 16:53:42 (GMT)
commit61947d12ec0d917d65a31b72dd14c2ee52c2ce5a (patch)
tree73d5cc27a2fdf277ab22129857f9bd85e2f6a300 /tests/thread.test
parentb6b49cf918923cfd65f36e367eb53becaaf6b264 (diff)
parentbc9648f913a629f7845e64a802b2519bb5a729a7 (diff)
downloadtcl-61947d12ec0d917d65a31b72dd14c2ee52c2ce5a.zip
tcl-61947d12ec0d917d65a31b72dd14c2ee52c2ce5a.tar.gz
tcl-61947d12ec0d917d65a31b72dd14c2ee52c2ce5a.tar.bz2
Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy multithreading. Thanks to Joe Mistachkin for the implementation of the fix, and Gustaf Neumann for the original report and testing the fix.
Diffstat (limited to 'tests/thread.test')
-rw-r--r--tests/thread.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/thread.test b/tests/thread.test
index bfef91c..3c0a1e1 100644
--- a/tests/thread.test
+++ b/tests/thread.test
@@ -254,6 +254,32 @@ test thread-6.1 {freeing very large object trees in a thread} testthread {
set res
} {0}
+test thread-8.1 {threaded fork stress} -constraints {thread} -setup {
+ unset -nocomplain ::threadCount ::execCount ::threads ::thread
+ set ::threadCount 10
+ set ::execCount 10
+} -body {
+ set ::threads [list]
+ for {set i 0} {$i < $::threadCount} {incr i} {
+ lappend ::threads [thread::create -joinable [string map \
+ [list %execCount% $::execCount] {
+ proc execLs {} {
+ if {$::tcl_platform(platform) eq "windows"} then {
+ return [exec $::env(COMSPEC) /c DIR]
+ } else {
+ return [exec /bin/ls]
+ }
+ }
+ set j {%execCount%}; while {[incr j -1]} {execLs}
+ }]]
+ }
+ foreach ::thread $::threads {
+ thread::join $::thread
+ }
+} -cleanup {
+ unset -nocomplain ::threadCount ::execCount ::threads ::thread
+} -result {}
+
# cleanup
::tcltest::cleanupTests
return