Tcl Source Code

Artifact [b460f9be63]
Login

Artifact b460f9be6314afc4988084aee0249e6058507e7c:

Attachment "threadpool_leakdemo84_slow.tcl" to ticket [3382401fff] added by auriocus 2011-07-30 12:48:31.
# version that leaks
package require Thread
set t [tpool::create]

proc leak {} {
	# compute 1000 rand() s in parallel
	set joblist {}
	for {set i 0} {$i<10} {incr i} {
		lappend joblist [tpool::post -nowait $::t {expr rand()}]
	}
	
	set max 0.0
	foreach job $joblist {
		tpool::wait $::t $job
	}
	foreach job $joblist {
		set max [tpool::get $::t $job]
	}
	puts -nonewline "."

}

time leak 1000000