# Create a thread pool and 2 jobs.
package require Thread
set tpool [tpool::create]
set job1 [tpool::post $tpool {after 1000}]
set job2 [tpool::post $tpool {after 2000}]

# Wait for the first job to complete.
set completed [tpool::wait $tpool [list $job1 $job2] pending]
puts "Completed = $completed"

# BUG: Pending list is empty, should be "2".
puts "Pending = $pending"

# Wait for the second job to complete.
tpool::wait $tpool $job2
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:
#
# Completed = 1
# Pending =
