Artifact
a3dacba34621a596e508822d36b121e315a817b2:
Attachment "postNowaitBug.tcl" to
ticket [3534581fff]
added by
tomkiti
2012-06-12 20:07:02.
# Create a thread pool.
package require Thread
set tpool [tpool::create -maxworkers 1]
# Create 5 jobs.
for {set i 1} {$i <= 5} {incr i} {
# BUG: The -nowait switch should post the job immediately, instead each
# job takes 2 seconds to post.
set job [tpool::post -nowait $tpool {after 2000}]
puts "[clock seconds] Posted job $i"
}
# Delete the pool.
tpool::release $tpool
# Wait for pool to terminate (?), otherwise receive error:
# "called Tcl_FindHashEntry on deleted table".
after 1 {set forever 1}
vwait forever
# Output:
#
# 1339505660 Posted job 1
# 1339505662 Posted job 2
# 1339505664 Posted job 3
# 1339505666 Posted job 4
# 1339505668 Posted job 5