Tcl Source Code

Artifact [d9df6e4b1d]
Login

Artifact d9df6e4b1d9ae80dc6439af93aa230f1155f271c:

Attachment "SampleTestuite2.itcl" to ticket [1449394fff] added by dharan 2006-03-14 14:39:04. Also attachment "SampleTestuite2.itcl" to ticket [1449383fff] added by dharan 2006-03-14 13:57:47.

package require Thread

for {set i 1} {$i < 15} {incr i} {

    puts "###############Inside Test $i"
    after 5000 {set flag 1}
    set script {puts "Inside Thread"
        puts "Inside Thread"
        puts "Inside Thread"
        puts "Inside Thread"
        puts "Inside Thread"
       thread::release
    }
    set noThread 5     
    for {set n 1} {$n <= $noThread} {incr n} {
        eval set threadId$n [thread::create -joinable]       
    }
    for {set n 1} {$n <= $noThread} {incr n} { 
        if {[catch {eval thread::send -async \$threadId$n \$script} msg]} {
            error "send script failed  $msg : $::errorInfo"
        }
    }

    for {set n 1} {$n <= $noThread} {incr n} {
        eval puts "\"Before Join \$threadId$n\""
        eval thread::join \$threadId$n
        puts "Check $threadId1 exist [eval thread::exists \$threadId$n]"
    }

    puts "Waiting..................$i"
    vwait flag

}

# end of file