TABLE OF CONTENTS
::pwtk::thread_wait
SYNOPSIS
proc ::pwtk::thread_wait {args} {
USAGE
thread_wait ?thread_id? ?thread_id ...?
PURPOSE
Wait for the specified threads to finish.
If called without arguments, the command waits for all the treads to finish.
ARGUMENTS
- args ... list of IDs of threads; an empty list implies all IDs
SOURCE
variable time_interval_ms variable thread if { $args eq "" } { set args [thread_ids] } if { [llength $args] == 1 } { set args {*}$args } print "Waiting for the threads $args to finish ...\n" foreach id $args { while { [::thread::exists $id] } { after $time_interval_ms } # remove this thread from thread(ids) set thread(ids) [lsearch -inline -all -not -exact $thread(ids) $id] } }