summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-07-23 17:09:58 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-07-23 17:09:58 (GMT)
commit0dfed6948cae4e926c49b5fc888b4b74b247a262 (patch)
tree085eb933a60ff0edec54f99a646543cbc8f64816 /tests
parentf42f4ba9e433ebb4b0234a6c5dbf445a82fe085a (diff)
parent61947d12ec0d917d65a31b72dd14c2ee52c2ce5a (diff)
downloadtcl-0dfed6948cae4e926c49b5fc888b4b74b247a262.zip
tcl-0dfed6948cae4e926c49b5fc888b4b74b247a262.tar.gz
tcl-0dfed6948cae4e926c49b5fc888b4b74b247a262.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')
-rw-r--r--tests/thread.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/thread.test b/tests/thread.test
index 6032bae..cc4c871 100644
--- a/tests/thread.test
+++ b/tests/thread.test
@@ -1412,6 +1412,32 @@ test thread-7.37 {cancel: send async thread cancel nested catch inside pure insi
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -result {{} 1 1 {eval unwound}}
+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