TCL TCLSH run the following threads, can normal output: Thread 2:0
Thread 2:1
Thread 2:2
Thread 2:3
Thread 2:4
Thread 2:5
Thread 2:6
Thread 2:7
Thread 2:8
Thread 2:9
Thread 2:10
Thread 1:1
Thread 1:2
Thread 1:3
Thread 1:4
Thread 1:5
Use wish runtime, returns 0, 0, you don't clear why, o Daniel help solve under
The source code is as follows:
# Thread1
The set Thread1 [thread: : create - joinable - preserved {
Proc exemple {{10} Max} {
Global w
For {set I 1} {$I & lt;=$Max} {incr I} {
Puts "Thread 1: $I"
}
}
Thread: : wait
}]
# # Thread2
The set Thread2 [thread: : create - joinable - preserved {
Proc exemple {{10} Max} {
For {set I 0} {$I & lt;=$Max} {incr I} {
Puts "Thread 2: $I"
}
}
Thread: : wait
}]
Thread: : send - async $Thread1 exemple 5 [list]
Thread: : send - async $Thread2 exemple 10 [list]
Thread: : release $Thread1
Thread: : $Thread2 release